I had this working at one time, now I can’t figure out what I did wrong. I have the following code:
Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject(“G:Student Fees ProgramCCHSMySchoolFeesHelpStudentLabels5162.doc”, “Word.Document”)
‘ Make Word visible. **THE PROBLEM IS THIS LINE.
objWord.Application.Visible = True
‘ Set the mail merge data source as the WorkingCopy database.
objWord.MailMerge.OpenDataSource _
Name:=”G:Student Fees ProgramCCHSMySchoolFeesHelpWorkingCopy.mdb”, _
LinkToSource:=True, _
Connection:=”QUERY Labels Query”
‘ Execute the mail merge.
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute
Set objWord = Nothing
End Function
The problem is the line ” Set objWord = GetObject(“G:Student Fees ProgramCCHSMySchoolFeesHelpStudentLabels5162.doc”, “Word.Document”). When I run this, I get a “Run-time error ‘-2147467259(80004005)’: Automation error Unspecified error”. What does this mean?