Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2000 Macro from VB

Status
Not open for further replies.

reaps

Technical User
Feb 4, 2003
2
GB
I've just updated my current project to work with Access 2000 as the backbone. I've had problems from the start but after a few major microsoft download i've solved most of the problems, but i can't seem to make run a macro from visual basic it worked fine from Access 97 by opening an invisible access then running the macro.

I can't get this to work but i also have another idea. That is to run a Access Macro shortcut (.MAM) file but i can't think how to run a program which isn't a microsoft program file or an exe any ideas?
 
Hello

Not sure about the first point.

This bit of code will run any file you specify with whatever application windows has associated to it.
Code:
This is the public declaration
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

this needs to be on the button
Dim hFile As Long
hFile = ShellExecute(Me.hwnd, "Open", "d:\temp\afile.ext", vbNullString, CurDir, 5)
If hFile < 32 Then
    MsgBox &quot;error&quot;
End If

So if windows knows what to do with a .mam file, so will ShellExecute.

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top