-
Global Macro Problem
Hey,
I am having a problem.
I would like to record a macro that i can run through a VB.NET app, but how do I create global macros with excel? I did it with word once and it worked fine.
Basically, I am creating new excel files with this program, and I then want to open up this excel file and run a macro on it, but it is a brand new excel file and has no macros.
Is there any way to create global macros in excel?
Thanks,
- Josh
-
Re: Global Macro Problem
Silly question but if you are running a macro that is doing formatting or setting up sheets or something, why not have it in you app too, so it creates a new workbook/sheet and does what it needs to?
Or are the macros for later use, in which case, you can (with difficulty) write code into the worksheets or you could create a template workbook and copy/use that when creating new workbooks.
-
Re: Global Macro Problem
The data is in the file, and the file is closed when I need to open the file back up and run the macro.
-
Re: Global Macro Problem
I keep all my macros in my PERSONAL.xls spreadsheet, and this opens automatically every time I use Excel and is thus available on the list of macros when I hit Alt-F8.
-
Re: Global Macro Problem
Thank you
I created Personal.xml
in XLStart.
is that correct?
-
Re: Global Macro Problem
This is my next question then.
I am trying to call this macro from a VB.NET app, and it says that the macro does not exist.
Is there anything special I must do in order to have this call proper?
Thanks again,
- Josh
-
Re: Global Macro Problem
Yes, the normal location is c:\Documents and Settings\username\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS
I've no experience with .NET so I'm not sure how you're supposed to call macros from within a .NET app, but if it's any help the macros are delimited by a ! normally. i.e.
PERSONAL.XLS!MyNewMacro
-
Re: Global Macro Problem
Joshua:
=======
You can also accomplish what you were originally trying to do by declaring your Public Variables in the Open Event for the Workbook. Note that the "ThisWorkbook" is an Object already defined by Excel. Check out this thread:
http://www.vbforums.com/showthread.php?t=340838
Good Luck and Good Programming!