ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Free-standing macros (https://www.excelbanter.com/excel-programming/340131-free-standing-macros.html)

Pflugs

Free-standing macros
 
Can a macro exist and run on its own outside of a spreadsheet? I wrote a
program that I'd like to run from, say, my Desktop rather than opening a
spreadsheet and clicking a button. Any ideas?

Thanks, Matthew


Tim Williams

Free-standing macros
 
Excel macros can only run in Excel. You might be able to convert your
code to a VBscript routine: all depends on what it does....

Tim.


"Pflugs" wrote in message
...
Can a macro exist and run on its own outside of a spreadsheet? I
wrote a
program that I'd like to run from, say, my Desktop rather than
opening a
spreadsheet and clicking a button. Any ideas?

Thanks, Matthew




Bob Phillips[_6_]

Free-standing macros
 
You should be able to do anything from VBScript, but it will require opening
an instance of Excel. Once you have a reference to an Excel object, you will
have the same options.

Here is a very trivial example that should be saved as a .vbs file and then
just launched

Dim xlApp

Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Add
MsgBox xlApp.ActiveWorkbook.Name
xlApp.Quit
Set xlApp = Nothing


--
HTH

Bob Phillips

"Pflugs" wrote in message
...
Can a macro exist and run on its own outside of a spreadsheet? I wrote a
program that I'd like to run from, say, my Desktop rather than opening a
spreadsheet and clicking a button. Any ideas?

Thanks, Matthew





All times are GMT +1. The time now is 10:21 PM.

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