Please Help With Path

  • Thread starter Thread starter AMANDA LAUGHLIN
  • Start date Start date
A

AMANDA LAUGHLIN

Does anyone know how to execute a microsoft word marco
from inside Access? Perhaps by writing an Access Macro?

Any suggestions welcome,
Amanda
 
I've done it with EXCEL macros, but haven't tried it with WORD Macros. But I
assume it can be done.

You would need to run VBA code in ACCESS (in ACCESS, a macro and VBA code
are not the same thing; however, in EXCEL and WORD they are) in order to use
Automation to access WORD and then to run the macro (don't have ready
process for this handy, but if you're interested I can do a bit of research
to find out).

Post back if this is of interest.
 
Hello Ken,

Nice to talk to you again.

I am not really familiar with VBA code but if you could
find a process I am sure I could tinker with it and figure
it out.

Your help would be very appreciated.

Amanda
 
OK - I'm tied up on a few things at the moment, but will do some testing and
post back.
 
Here is an example of how to call and run a Word macro from ACCESS:

Public Sub RunAWordMacro()
Dim wrd As Object, wdoc As Object
Dim strFile As String, strModule As String, strMacro As String
' Set name of file to be opened (the one that has the macro)
strFile = "Ken"
' Set name of module that contains the macro in document
strModule = "Module1"
' Set name of macro
strMacro = "Testing1"
' Open WORD
Set wrd = CreateObject("Word.Application")
wrd.Visible = True
' Open the WORD document
Set wdoc = wrd.Documents.Open("C:\" & strFile & ".doc")
' Run the macro
wrd.Run strFile & "!" & strModule & "." & strMacro
wdoc.Close False
Set wdoc = Nothing
wrd.Quit
Set wrd = Nothing
End Sub
 
Back
Top