Relocating a macro

  • Thread starter Thread starter davegb
  • Start date Start date
D

davegb

I accidentally created a macro in the worksheet I was working on at the
time instead of in PERSONAL.XLS. I have tried to move or delete macros
before and gotten annoying messages afterward when I opened the
original file saying "VBA Error!" etc, etc. In some cases, XL couldn't
find the macro after I moved it. What is the correct protocol for
moving a macro from a regular spreadsheet to the PERSONAL.XLS
spreadsheet without causing complications?
TIA
 
Hi Dave,
Perhaps you could indicate a bit better what you actually did.

If you are running a macro from Alt+F8, even though you may
give the macro with just the macro name, it will actually prefix
the macro name with the workbook name. Actually if not there
it won't be in the list, but this applies to your toolbar buttons and
menus so you may have additional changes to make.

Once having created your personal.xls file in your XLSTART
directory did you hide the workbook (window, hide)

See Getting Started with Macros
http://www.mvps.org/dmcritchie/excel/getstarted.htm

If this is a User Defined Function then you must specify
the workbook name or go through hoops.
http://www.mvps.org/dmcritchie/excel/install.htm
 
Thanks for your reply, Dave.
I created the macro in a temp spreadsheet called "Book2.xls". When I
access the macro through Alt F8 or Tools, Macro, no problem. If I'm in
Book2, it has no filename prefix. If I access it from any other
spreadsheet, it appears as "Book2.xls!MoveFoldertoFolder". No problem.
Of course, I can't access it unless Book2 is open.
I already have created Personal.xls and it is normally hidden, except
when I access the other macros there. What I want is to put
FoldertoFolder in the Personal worksheet. I've had troubles in the past
moving and deleting macros. I'd like to avoid such problems now. How do
I get FoldertoFolder from the book2 worksheet to Personal?
 
You should be able to just copy|paste that procedure from the "bad" project
(book2.xls) to your personal.xls project.

Then delete it from book2.xls.
See Debra Dalgleish's site if you have trouble:
http://www.contextures.com/xlfaqMac.html#NoMacros

If you've assigned that macro to a button (on a toolbar or on a worksheet),
you'll have to reassign it.
 
Back
Top