Running Word 2000 Macros from Other VBA Programs 
Author Message
 Running Word 2000 Macros from Other VBA Programs

I am already using Access 2000 to start Word and do some things.

How do I get Access VBA to run a Word macro by name?



Sat, 03 Sep 2005 14:23:03 GMT  
 Running Word 2000 Macros from Other VBA Programs
Hi Howard,

You can use the following code:

oWordApp.Run "TemplateName.ModuleName.MacroName"

See "Run Method" in VBA Help for more information.

Kathleen

Quote:
>-----Original Message-----
>I am already using Access 2000 to start Word and do some
things.

>How do I get Access VBA to run a Word macro by name?

>.



Sat, 03 Sep 2005 15:15:32 GMT  
 Running Word 2000 Macros from Other VBA Programs
Howard

Once you have a reference to the Word Application object say: appWrd, you can
use:

    appWrd.Run "Normal.Module1.Main"

This example would try to run a macro called "Main", from "Module1" in the
"Normal" project.

Check Words online help for more information.

You can also the Word fire macros such as AutoNew (or Document_New) or
AutoOpen (or Document_Open) automatically when you create or open a document.

I hope this helps + Cheers - Peter


Quote:
> I am already using Access 2000 to start Word and do some things.

> How do I get Access VBA to run a Word macro by name?



Sat, 03 Sep 2005 15:29:34 GMT  
 Running Word 2000 Macros from Other VBA Programs

Quote:
> How do I get Access VBA to run a Word macro by name?

Apart from the two ways of doing this
here's another way:

Treat a macro like it's a method to the ThisDocument class

macro in Word ThisDocument module
Sub MacroIncludingArgument(ByVal MyArgument As String)
    MsgBox MyArgument
End Sub

Calling above macro from another app wud sound like
    Dim wd As New Word.Application
    Dim doc As Word.Document

    Set doc = wd.Documents.Open("c:\Temp\Doc10.doc")
    doc.MacroIncludingArgument "Hello World"

Krgrds,
Perry



Quote:
> I am already using Access 2000 to start Word and do some things.

> How do I get Access VBA to run a Word macro by name?



Sun, 04 Sep 2005 04:35:05 GMT  
 
 [ 4 post ] 

 Relevant Pages 

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

2. Word 2000 macro running under Word 97

3. Does Word VBA 2002 developed code run on Word 2000

4. How do you send Outlook 2000 email using WORD 97 VBA Macro

5. A question on word 2000 - VBA how to macro

6. Word 2000 modify Macro with VBA, how?

7. Moving folders from within a VBA macro in Word 2000

8. Word 2000 modify Macro with VBA, how?

9. Help - Outlook 2000 crashes *sometimes* when running my VBA macro

10. Running a macro with arguments on Word 2000 startup

11. Running a Microsoft Word Macro from Outlook 2000

12. Automatically Run Local Word 2000 Macro when document opens

 

 
Powered by phpBB® Forum Software