Can any one tell me the problem with this???
Private Sub Option3_Click()
Shell "D:\archive\DUMMY_1040MFS.DOC"
End Sub
It generates the error:
Run time error '5':
Invalid call procedure or argument.
I am trying to run a mail merge document from access.
Also when I use:
Private Sub Option3_Click()
'Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("D:\archive\DUMMY_1040MFS.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as CorrBatch4Pasted.
objWord.MailMerge.OpenDataSource _
Name:="D:\archive " & _
"National Archive.mdb", _
LinkToSource:=True, _
Connection:="TABLE CorrBatch4Pasted", _
SQLStatement:="SELECT * FROM [Forms]![Batch 4 stat query]![Combo2]"
' Execute the mail merge.
objWord.MailMerge.Execute
'End Function
End Sub
My refrences would gray out when I open my switch board thus making my code non-functional and the error
Compile error:
User-defined type not defined
Reg
Private Sub Option3_Click()
Shell "D:\archive\DUMMY_1040MFS.DOC"
End Sub
It generates the error:
Run time error '5':
Invalid call procedure or argument.
I am trying to run a mail merge document from access.
Also when I use:
Private Sub Option3_Click()
'Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("D:\archive\DUMMY_1040MFS.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as CorrBatch4Pasted.
objWord.MailMerge.OpenDataSource _
Name:="D:\archive " & _
"National Archive.mdb", _
LinkToSource:=True, _
Connection:="TABLE CorrBatch4Pasted", _
SQLStatement:="SELECT * FROM [Forms]![Batch 4 stat query]![Combo2]"
' Execute the mail merge.
objWord.MailMerge.Execute
'End Function
End Sub
My refrences would gray out when I open my switch board thus making my code non-functional and the error
Compile error:
User-defined type not defined
Reg