Change macro to an exe

D

Douglas J. Steele

Assuming you're talking about macros in Access, the database product that's
part of Office Professional, it can't be done. It's also not possible to
convert Access VBA to an executable.
 
B

Brian

If what you are looking for is a way to distribute an Access application to
workstations that do not have Access installed, what you need is Access
runtime. This is purchased separately from Access as part of Visual Basic
Tools for Office, which allows you to distribute the runtime version of
Access that allows users to run Access apps you create, but not edit code or
form design, etc.
 
S

Steve Schapel

In this context, I should point out that the Access 2007 runtime is
simply a freely available download from Microsoft website.
 
S

SandySun

Well, I have a third party product that downloads data, and after it finishes
it can execute an external command that I was hoping would fire off a macro
and upload the data. I know that I can create an autoexec within Access; so
that when it opens it would run the upload macro.....however I have several
different uploads that occur throughout the day. I was hoping to steer clear
of creating a new database for every different kind of upload. Any
suggestions??
 
B

Brian

Ah. Now we get to the heart of the matter.

You can have your third-party program run a command like this:

"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe"
"C:\MyAppFolder\MyApp.mdb" (that's all one line)

This will open your Access application, which would automatically run your
AutoExec macro.

However, as you say, you have different types of uploads. Given sufficient
information to differentiate between them, Access will be able detemine the
correct upload type for each one.

This raises this question: can you identify what type of upload is needed
based on the name, extension, or location of the downloaded file?

If Yes, then you could easily make a form that opens automatically when you
start your application (forget the macro). Have that form do these things
automatically when it opens:

A. Look for the downloaded file.
B. Based on some factor above, determine the type of upload needed.
C. When finished, close the application.

This could all be done in Visual Basic in the form's code module. Post some
more specifics on the file names/extensions/locations, etc. and the upload
method(s), and we can get you some help on accomplishing it in VBA.
 
S

Steve Schapel

Or, you could make a separate macro for each of the uploads, and tack
the macro name on the end of the command line as given, using the /x
switch, something like this:

"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe"
"C:\MyAppFolder\MyApp.mdb" /x macroname

If applicable, you could use Windows Task Manager, or a third party
scheduling utility, to run this command.
 
B

Brian

That's a very useful piece of info. I spend my time in VBA and rarely use
macros, so I did not realize one could pass the macro name along as an
argument as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top