Forum Discussion
Using mail merge in excel without word
Hi,
I am after your advice on how to open a mail merge Word doc with data in an Excel spread sheet...
I have an Excel spread sheet that I run a macro in to tidy up the data, before then using the data for a Word mail merge. At the end of my Excel macro I want to open the Word document. I have the code below which opens the Word document however it breacks the mail merge link when I use this code.
If I open the Word document manual I get a prompt saying "opening this document will run the following SQL command..." (see pic below). If I click on yes my mail merge works correctly. I am guessing that when I open the Word doc (with the macro) that "No" is being selected.
Thanks in advance for your help
Sub OpenWord()
Set wordapp = CreateObject("word.Application")
ChDir "C:\A1 Labels"
Workbooks.Open Filename:="C:\A1 Labels\Labels DATA.xlsx"
End Sub
1 Reply
- Richard WeinCopper ContributorHi Mike. You said your code is for opening a Word document, But it's actually opening an Excel workbook. Did you post the wrong code?