PDA

View Full Version : macros can't find macros in personal.xls



OlderDaze
01-06-2009, 11:19 PM
I have exported the macros and functions to .bas files.
I have used the nice code for loading all appropriate files and creating a personal.xls file if necessary.

AddPersonal loaded up all the macros that I wanted. When I load up the workbook excel locates and loads the personal.xls file but none of the macros are recognized.

The only macro in personal.xls that Alt-F8 will recognize is the original macro that I recorded to personal.xls when I created it.

Why are the other ones not recognized?

Robin

Bob Phillips
01-07-2009, 02:24 AM
Are the macos private?

Are the modules private?

Are they functions?

OlderDaze
01-07-2009, 09:31 AM
The AddPersonals macro reads *.bas files. So I pulled all of the subs and functions I had in the personal.xls file and moved them to a single module in my workbook then exported that module to "personal.bas". One of the subs was a renaming of the macro I used to originally create personal.xls in %app_data&. This whole process left Personal.xls empty. All files were saved and I exited excel. I opened my workbook. The personal.xls file was also opened. The perosonal.xls modules were empty. I ran AddPersonals macro. The personal.bas file was specified. The result was that personal.xls had all of the subs and functions and the renamed macro imported. Alt-F8 showed all of the macros in my workbook and the one renamed macro in peronsal.xls. The other subs and functions were not recognized. All of the subs and functions are default public -- there are no private statements, there are no classes or object definitions.
I saved all workbooks, exited excel, restarted excel and opened my workbook. Same results.

Thanks for your help.

Robin

lucas
01-07-2009, 09:35 AM
Ok, I will ask the obvious question. Why are you doing this?

Read up on addins. It will make your life much easier.

Bob Phillips
01-07-2009, 09:49 AM
POst the offending files and let us see this.

OlderDaze
01-07-2009, 01:11 PM
I'm looking around MS Excel Help and it seems that I need to Add and Install a .xla file but I can't find instructions on creating such a file.

The reason I'm looking at personal.xls is because it was what I had used years before to store common subs and functions between workbooks. Addins would be fine. Easy is good. Can you point me to an article so I can do my homework?

Robin

lucas
01-07-2009, 03:24 PM
You bet Robin, try this for a good point to start.

http://vbaexpress.com/forum/showthread.php?t=10855

If you have questions, you can post them here. Glad to see you interested in this solution to your problem, you won't be sorry.

The main thing I would suggest when developing addins is that when you reference a workbook in your code, remember to use activeworkbook instead of thisworkbook or you will be referencing the addin instead of the file or workbook you want to take an action on.

OlderDaze
01-07-2009, 03:33 PM
Thanks for the link,. Steve.
Are addins supported in Excel 2003?
I hate pushing a requirement of 2007 on people who are still using WinXP and havent upgraded yet.

Robin

lucas
01-07-2009, 03:43 PM
Absolutly. I don't have 2007

addins as far as I know are supported all the way back to 97 but you need to test your code for compatibility with each version.....there are some differences in what code works with different versions.