vba equivalent of an autorun xlm file

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

A stand-alone autorun xlm file, when clicked, will automatically
run the macro. Is there a vba equivalent of such thing? All the
script files (.bas) I created, when clicked, ask me to choose a
program to open them. And when I choose Excel, Excel simply opens
the files but does not run the macro.

What do I need to do to be able to double-click a vba file and run
the macro, without running Excel first?
 
vbscript ?

or create an excel file containing the macro and link it to the workbook_open event
 
John,
Basically, you can't. VBA need a container to run in, Excel in this case.
VBA is designed to interact with its host and if that host does not exist,
it cannot function.

Depending on what you are trying to do (that does not involve Excel),
VBScript may be suitable.
These can be run "standalone".

NickHK
 
You could create a normal workbook (.xls file) and put the code into a General
module.

Name the procedure Auto_Open.
 

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

Back
Top