# Microsoft Office Application Help - Excel Help forum > For Other Platforms(Mac, Google Docs, Mobile OS etc) >  >  How to choose field- and record delimiter for a Mail Merge document using VBA

## Pascal Lottaz

hy,

I'm new to VBA and I'm trying to create a word macro that auto-imports data from a .txt file using word's Mailmerge option. This should allow me to export data from a third party software and then have that data filled into my word document at desired places. 

In the following macro, everything is working fine EXCEPT for Word prompting me with a very annoying text box asking me to choose the field and record delimiter. I must add though that word only prompts me with that text box if the .txt uses delimiters other than the standard (tab) and (enter) delimiters. With those two delimiters in the text file the text box will not show up, word will automatically import the data. But I don't want to use these delimiters because they are likely to show up at some point in my .txt file within a field. I need a different delimiter. 

Does anyone know how to use non-standard delimiters AND avoid that horrible text box? Any help would be hugely appreciated.

here is my macro:

Sub AutoOpen()
'
' Auto_Populate Macro
'
'
    ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
    ActiveDocument.MailMerge.OpenDataSource Name:= _
        "ThisWorkbook.Path:TIMESENSOR.txt", _
        ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
        AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
        WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
        Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="", SQLStatement1 _
        :=""
    ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
    ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
    Set vbCom = Application.VBE.ActiveVBProject.VBComponents
    vbCom.Remove VBComponent:= _
    vbCom.Item("TS_TEMPLATE")
End Sub

----------

