codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  automation of Word Mail Merge  kblake6973 at 00:04 on Tuesday, July 11, 2006
 

I am trying to automate the merging of data from an Excel spreadsheet into a Word document. The code below works, however, I have to press "OK" when it's trying to open the data source. It wants me to select the table to use (which is the only 'table' in the spreadsheet -- so the selection defaults to it anyway).. I'd like to NOT have to press enter.. and for the mail merge to just accept the default table selected. .. Any ideas?

Set WORDApp = CreateObject("Word.Application")
WORDApp.Visible = 0
WORDApp.DisplayAlerts = False
WORDApp.Documents.Open "c:\billimage\GENERICM.doc"
wformat = 1
wconfirmconv = 0
wreadonly = 0
wlinktosource = 1
waddtofilelist = 0
wpassworddoc = ""
wpasswordtemp = ""
wrevert = 0
wprotectdoc = ""
wprotecttemp = ""
wconn = ""
wsqlstatement = ""
WORDApp.ActiveDocument.MailMerge.OpenDataSource xlsfile, wformat, wconfirmconv, wreadonly, wlinktosource, waddtofilelist, wpassworddoc, wpasswordtemp, wrevert, wprotectdoc, wprotecttemp, wconn, wsqlstatement
With WORDApp.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  Security - Code verify
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007