Compile Error - Expected Expression

meandmyhorse

New member
Local time
Today, 00:03
Joined
Jul 31, 2002
Messages
6
I'm still trying to figure out this mail merge stuff. I have been trying the many samples from this board and listed in MS Knowledgebase.

I keep getting a compile error when I type the following code (listed right off Knowledgebase)

Dim objWord As Word.Document
Set objWord = GetObject("d:\data\independent contract.doc", "Word. Document")
'Make Word Visible
objWord.Application.Visible = True
'Set the mail merge data source
objWord.MailMerge.OpenDataSource Name:="C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" & "d:\data\access\temp.mdb"
LinkToSource:=True, Connection:="QUERY qryIndependent"

It hightlights the := next to LinkToSource and Connection and gives me the compile error.

I doubled check that I am using the right programs referenced in the document (Access 97 and Word 97) and that Microsoft Access 8.0 Object Library is checked.

What gives? I see the LinkToSource:= in many of the other samples posted out on the board.

Aargh. The trouble us entry level users get into.
 
The line of code below has to be on ONE line and , need as well.

objWord.MailMerge.OpenDataSource Name:="C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" & "d:\data\access\temp.mdb", _
LinkToSource:=True, Connection:="QUERY qryIndependent"


Sorry if it is.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom