Solved

using access macro with vb

Posted on 2000-02-16
1
187 Views
Last Modified: 2010-05-02
How do i call and activate an Access Macro from VB application?
0
Comment
Question by:gsagy
1 Comment
 
LVL 3

Accepted Solution

by:
kfrick earned 75 total points
ID: 2528059
This (VB5) code will run a macro:


    Dim objAccess As New Access.Application
    objAccess.OpenCurrentDatabase (App.Path + "\" + gszDatabaseName)
    objAccess.DoCmd.SetWarnings False
    objAccess.DoCmd.RunMacro "Excel Output Macro", 1
    objAccess.CloseCurrentDatabase

You need to include a reference to the "Microsoft Access 8.0 Object Library", or whatever version of acces you'r using.

Keep in mind that this requires the correct version Access to be properly installed in the target machine. This code will fail if a full-blown version of Access (featuring Automation) is not installed.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Link a textbox in excel to a cell with more than 255 characters. 5 84
VBA color chart bars 12 85
Child Form in front 4 46
VBA - If Bookmark = "XXBOOKMARKXX" then 15 25
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question