C
Caroline Higson
Hello lovely kind people!
I want to open a letter in Word 03 from Access 03 with my merge fields
in, merge, and print. It worked once, but now it's not? It highlights
the first line and comes up with a complie error: user defined type not
defined. Does anyone know what's wrong with my code (which I "borrowed"
off here!)?
Dim objWord As Word.Document
Set objWord = GetObject("C:\ICT2\welcome letter.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Rat Rescue database.
objWord.MailMerge.OpenDataSource _
Name:="C:\ICT2\db7.mdb", _
LinkToSource:=True, _
Connection:="TABLE Table1", _
SQLStatement:="SELECT * FROM [Table1]"
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Function
Thanks in advance!
Caroline
I want to open a letter in Word 03 from Access 03 with my merge fields
in, merge, and print. It worked once, but now it's not? It highlights
the first line and comes up with a complie error: user defined type not
defined. Does anyone know what's wrong with my code (which I "borrowed"
off here!)?
Dim objWord As Word.Document
Set objWord = GetObject("C:\ICT2\welcome letter.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Rat Rescue database.
objWord.MailMerge.OpenDataSource _
Name:="C:\ICT2\db7.mdb", _
LinkToSource:=True, _
Connection:="TABLE Table1", _
SQLStatement:="SELECT * FROM [Table1]"
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Function
Thanks in advance!
Caroline