Consulting

Results 1 to 3 of 3

Thread: Solved: run access macro from excel

  1. #1
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Indiana
    Posts
    113
    Location

    Solved: run access macro from excel

    Hey guys,

    Is there a way to run an access macro from excel. Lets say I have test1.mdb located at R:\Test and I want to run the macro called "autoexec". I do not want access to stay open after this. The point of doing this is so that I can have access prepare my tables for me, then using a dashboard made in excel to open excel sheets that depend on these tables. If anyone could provide me with a module or something to achieve this, it would be greatly appreciated. Thanks!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Indiana
    Posts
    113
    Location
    I see the code that you said was needed:

    Sub RunAccessMacro()
    Dim appAccess As Object

    Set appAccess = CreateObject("Access.Application")

    With appAccess
    Application.DisplayAlerts = False
    .Opencurrentdatabase glob_sdbPath
    .DoCmd.OpenModule "Module1"
    .Run "Update_data"
    '.Quit
    End With
    Set appAccess = Nothing
    End Sub


    I am not sure where to put the path of my database and then the macro name. Looks like you are opening a module then running something else. Not quite sure.

Posting Permissions

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