Results 1 to 3 of 3

Thread: Macro from Word

  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sunrise, Florida
    Posts
    324
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro from Word

    I use both Word and Access 97. Is there a way to use a macro built in Word within Access? Any help appreciated!

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro from Word

    I'm not quite clear on what application you want to run the macro with. If you want to execute a Word Macro via Access to a Word Document, here's a code sample:<pre>Private Sub btnWordMacro_Click()
    Dim appWord As New Word.Application
    Dim docWord As Word.Document
    Set docWord = appWord.Documents.Open("C:WindowsDesktopDocument1. doc") 'Opens the specified Document
    appWord.Run "<YourMacroName>" 'Runs the specified Macro
    appWord.Visible = True 'Makes Word Visible to the user
    End Sub</pre>

    Be sure that the Microsof Word Object library is added to your References (under Tools|References in the VBA Editor - in Access).

    You can also send commands to Word - just like a macro in Word - through Access. The only thing is that you would have to make a few changes in the code to reflect the fact that it is running under the Access environment.

    Hope this helps <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sunrise, Florida
    Posts
    324
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro from Word

    My mistake. I was not clear. This is the prob.
    I have a macro in Word97 that I use to calculate dates in the future making sure it doesn't fall on a holiday or weekend. No problem there. What I want to know is if I can use the instructions in that macro (cut and paste) in an Access macro. Thanks for any advice!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •