Assign macro broken after reference removed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am in the middle of trying to convert my file from a permanent reference to
using RUN. In the main spreadsheet are a number of userform button’s which
call a macro (Sub Menu_New_Site) in one of the modules in the .xla. When I
have a reference set to the .xla the button’s work fine, if I remove the
reference I get the following error:

"The macro 'Menu_New_Site' cannot be found"

Any ideas?
 
I think I'd create a local macro that calls the macro in the .xla. (It seems
easier to me.)

sub Local_menu_new_site()
application.run "'addinname.xla'!Menu_New_Site"
end sub

I didn't test this, but it seems like it would react to changes in the xla
location better than assigning the macro directly.
 
Dave,

Many thanks, this is my backup if I can not get an answer to my thread "VBA
code to set a reference". If I can get this to work I will not have to make
the changes as you have suggested (I have about 50 button's, so I am not
overly keen to going and edited them all, but will if I have to!)

BTW is there any difference between:

application.run "'addinname.xla'!Menu_New_Site"

and

run "'addinname.xla'!Menu_New_Site"

I have been using the later, is this an issue?
 
I don't think it ever hurts to fully qualify stuff.

But it's not always necessary.
Dave,

Many thanks, this is my backup if I can not get an answer to my thread "VBA
code to set a reference". If I can get this to work I will not have to make
the changes as you have suggested (I have about 50 button's, so I am not
overly keen to going and edited them all, but will if I have to!)

BTW is there any difference between:

application.run "'addinname.xla'!Menu_New_Site"

and

run "'addinname.xla'!Menu_New_Site"

I have been using the later, is this an issue?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top