Results 1 to 3 of 3

Thread: Running A Macro From VB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Post

    Can anyone show me how I can run a macro from within VB without having to open Access 97 ?


  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    This should work (i didn't test it though..)

    1) Add a reference to the Microsoft Access 8.0 Object Library

    2) Add this code:
    Dim axs As New Access.Application

    axs.OpenCurrentDatabase ("c:\file\path\here.mdb")
    axs.DoCmd.RunMacro "MacroName"
    axs.CloseCurrentDatabase

    Set axs = Nothing

    All done!

    HTH

    Tom

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Post

    Thank you Clunietp, that worked fine.

    Regards
    nmretd

Posting Permissions

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



Click Here to Expand Forum to Full Width