Copy and pasting files with macros

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

Guest

I have written some macros in an excel file and assigned these macros to
custom toolbar buttons. This works great until I copy and paste the file and
open the new copy. The macro link for the buttons points to the original
macro. Is there anyway to set this up so that I don't have to re-assign the
macro every time and look at the open file instead.
 
Kevin

Difficult to tell without the code, but if it has an actual reference in the
code to the workbook name, e.g..

Workbooks("OriginalBook")...........

Then you would do better to use something like the ThisWorkbook object.
This always points to the workbook containing the code.

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 

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