Help with Selecting Merge Table

J

Jenny B.

Hi All,

I setup a Macro that opens a text file into Excel and then immediately
formats the data and lastly merges the data to an already formatted Word
Merge doc.

My question is, what can I add to the below code to make the routine
automatically select the merge table vs. the Macro pausing and having the
user select? The table (tab) from Excel this is merging from is named
“MergeHomeâ€.

Thank you in advance for any thoughts – Jenny B.


Sub Word()

Application.ScreenUpdating = False
Call JLBtheGreat
strLetterPath = "C:\Documents and Settings\jenny\Desktop\Transmittal.doc"
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
Set wdDoc = appWD.Documents.Open(Filename:=strLetterPath)
wdDoc.MailMerge.OpenDataSource Name:="C:\Documents and
Settings\jenny\Desktop\Splash Screen.xls", _
ConfirmConversions:=False, _
Connection:="", SQLStatement:="", SQLStatement1:=""

Application.ScreenUpdating = True

appWD.Run "MergeLines"

End Sub
 
J

Joel

I went to Word and looked at the help for opendatasource. the help said to
put in the connect the word table followed by the table name when using
access. Since a table in Access is the same as a worksheet in excel that is
the answer

from
Connection:=""
to
Connection:="Table Sheet1" or equivalent.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top