M
mio
Hi, I have tried run macro that is placed in Normal.dot template from Access
VBA code but it doesn't work.
VBA returns error: Object doesn't support this property or method.
Code in Access:
WFile = Application.CurrentProject.Path & "\MailLabels.doc"
DBname = Application.CurrentProject.FullName
Connect = "TABLE tblCustomers"
'Open connection to Word and make Word visible.
Set myWDApp = CreateObject("Word.Application")
myWDApp.Application.Visible = True
'Run mailing label procedure.
myWDApp.Application.Run "Normal.modHC.WMailLabels", WFile, DBname, Connect
Called procedure in Word Normal.dot Module:
Public Sub WMailLabels(strWFileName As String, strDBname As String,
strConnectTo As String)
Dim myDoc As Document
'Set reference to the document
Documents.Open FileName:=strWFileName
etc.....
When called procedure in Word hasn't arguments, it's all right.
If it has arguments -> ERROR!
What can be wrong?
VBA code but it doesn't work.
VBA returns error: Object doesn't support this property or method.
Code in Access:
WFile = Application.CurrentProject.Path & "\MailLabels.doc"
DBname = Application.CurrentProject.FullName
Connect = "TABLE tblCustomers"
'Open connection to Word and make Word visible.
Set myWDApp = CreateObject("Word.Application")
myWDApp.Application.Visible = True
'Run mailing label procedure.
myWDApp.Application.Run "Normal.modHC.WMailLabels", WFile, DBname, Connect
Called procedure in Word Normal.dot Module:
Public Sub WMailLabels(strWFileName As String, strDBname As String,
strConnectTo As String)
Dim myDoc As Document
'Set reference to the document
Documents.Open FileName:=strWFileName
etc.....
When called procedure in Word hasn't arguments, it's all right.
If it has arguments -> ERROR!
What can be wrong?