Application.Run Method in VBA

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top