Solved

using access macro with vb

Posted on 2000-02-16
1
184 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now