Run word macro from Access module code 
Author Message
 Run word macro from Access module code

Can someone provide me with the module code to run a word macro from access
using module code. I know the shell command but I am looking for some code
using Getobject or creatobject.
TIA



Tue, 20 May 2003 03:00:00 GMT  
 Run word macro from Access module code
Hi KP,

In your Access project set a reference to Word and use code like this:

Try something like this to run a macro named 'hello'
-------------------------------------------------------
Dim oApp As Word.Application
On Error Resume Next
'Check to see if Word's already open, if not, open it
Set oApp = GetObject(, "Word.Application")
If Err <> 0 Then
    Set oApp = CreateObject("Word.Application")
End If
'Activate Word and make it visible
oApp.Activate
oApp.Visible = True
'Add a new document
oApp.Documents.Add
'Run the macro Hello
oApp.Run "hello"
Set oApp = Nothing
-------------------------------------------------------

Hope this helps,
regards,
Astrid

Please post replies to the newsgroup so that other readers can contribute or
benefit.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> Can someone provide me with the module code to run a word macro from
access
> using module code. I know the shell command but I am looking for some code
> using Getobject or creatobject.
> TIA



Wed, 21 May 2003 07:58:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Run Excel Macro from within Access module

2. Running Word Macro in Access

3. How to run Word macro from Access?

4. Run Word Macro from Access

5. Running Macros on Word OLE objects in Access

6. Word Macro runs then gets Macro Not Found

7. Word Macro runs then gets Macro Not Found

8. Running a word Macro & an excel macro

9. Accessing Macro Code in Word

10. Running an access macro with VB Code?

11. Code to schedule modules to run every hour (or multiple daily runs)

12. My Word 97 macros don't run in Word 2000

 

 
Powered by phpBB® Forum Software