ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba equivalent of an autorun xlm file (https://www.excelbanter.com/excel-programming/377348-vba-equivalent-autorun-xlm-file.html)

John Smith

vba equivalent of an autorun xlm file
 
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?

Tim Williams

vba equivalent of an autorun xlm file
 
vbscript ?

or create an excel file containing the macro and link it to the workbook_open event

--
Tim Williams
Palo Alto, CA


"John Smith" wrote in message ...
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?




NickHK

vba equivalent of an autorun xlm file
 
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

"John Smith" wrote in message
...
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?




Dave Peterson

vba equivalent of an autorun xlm file
 
You could create a normal workbook (.xls file) and put the code into a General
module.

Name the procedure Auto_Open.

John Smith wrote:

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?


--

Dave Peterson


All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com