How to open an external Windows program in Access VBA

User avatar
Carol W.
3StarLounger
Posts: 390
Joined: 26 Jan 2010, 16:02
Location: Las Vegas, NV

How to open an external Windows program in Access VBA

Post by Carol W. »

Well, we finally broke down and purchased a mass mailing program. The business edition of this program links to Access tables (and supposedly queries, but that's another matter) automatically.

I had to write a macro consisting of several make table and append queries to accomplish this. This all works well. What I would like to do is to open that program from within my VBA code before I execute the Quit command.

Code: Select all

Private Sub Command17_Click()
strerrmsg = ""

If List18.Column(0) = "All" Then
   DoCmd.RunMacro "mcr-Combine DS and Members"
   MsgBox "This function is now being performed in GroupMail. Email addresses have been prepared for GroupMail. The membership database will now close. Please open GroupMail."
   Quit
Else
  Call SendGrpMessage
End If

End Sub
If this is possible (I think it may be), how do I do this?

Thanks, in advance.
Carol W.

User avatar
HansV
Administrator
Posts: 78542
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to open an external Windows program in Access VBA

Post by HansV »

You can start an external program using Shell:

Shell "C:\Program Files\Subfolder\Programname.exe", vbNormalFocus

(You should substitute the full path and name of the program.) If you prefer to start it maximized, change vbNormalFocus to vbMaximizedFocus.
Best wishes,
Hans

User avatar
Carol W.
3StarLounger
Posts: 390
Joined: 26 Jan 2010, 16:02
Location: Las Vegas, NV

Re: How to open an external Windows program in Access VBA

Post by Carol W. »

Perfect!

Thanks, as always. :thankyou:
Carol W.