Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Moving Macros with Sheets to New Workbook

Thanks for taking the time to read my question.

I have a workbook that has a lot of sheets in it. I'd like to be able to
make a copy of a sheet and place it in a new workbook, then e-mail the new
workbook. I want to send just the one sheet becuase each sheet is for a
different customer, and the information is sensitive.

My problem is... I have macros on each sheet. When I copy a sheet into a
new workbook, the macro comes with it, but the button on the sheet still
points to the macro in the original workbook. You have to right mouse click
"Assign Macro" and choose the macro in the current workbook. I don't want
the clients to have to do this.

Is there a property setting that tells Excel to use the macro in the new
workbook instead of the old workbook.

Thanks again for the help.

Brad


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Moving Macros with Sheets to New Workbook

The answer is:

Create a button using the Control Toolbox instead of the Forms toolbar.

Doing this will embed the code to the button, not the workbook, and the
macro will move with the sheet.

Brad

"Brad" wrote:

Thanks for taking the time to read my question.

I have a workbook that has a lot of sheets in it. I'd like to be able to
make a copy of a sheet and place it in a new workbook, then e-mail the new
workbook. I want to send just the one sheet becuase each sheet is for a
different customer, and the information is sensitive.

My problem is... I have macros on each sheet. When I copy a sheet into a
new workbook, the macro comes with it, but the button on the sheet still
points to the macro in the original workbook. You have to right mouse click
"Assign Macro" and choose the macro in the current workbook. I don't want
the clients to have to do this.

Is there a property setting that tells Excel to use the macro in the new
workbook instead of the old workbook.

Thanks again for the help.

Brad


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Moving Macros with Sheets to New Workbook

A workaround might be
activesheet.copy
for each btn in activesheet.buttons
btn.OnAction = application.Substitute(btn.OnAction, _
oldfilename,newfilename)
Next

Is the code for the buttons in the sheet module?



--
Regards,
Tom Ogilvy

"Brad" wrote in message
...
Thanks for taking the time to read my question.

I have a workbook that has a lot of sheets in it. I'd like to be able to
make a copy of a sheet and place it in a new workbook, then e-mail the new
workbook. I want to send just the one sheet becuase each sheet is for a
different customer, and the information is sensitive.

My problem is... I have macros on each sheet. When I copy a sheet into a
new workbook, the macro comes with it, but the button on the sheet still
points to the macro in the original workbook. You have to right mouse

click
"Assign Macro" and choose the macro in the current workbook. I don't want
the clients to have to do this.

Is there a property setting that tells Excel to use the macro in the new
workbook instead of the old workbook.

Thanks again for the help.

Brad




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
moving data between workbook sheets Soosieboo Excel Discussion (Misc queries) 3 September 23rd 08 10:45 PM
Moving Sheets within a workbook dan Excel Worksheet Functions 5 August 4th 06 10:58 PM
Macros for Protect/Unprotect all sheets in a workbook Paul Sheppard Excel Discussion (Misc queries) 2 August 4th 05 04:30 PM
Moving a variable number of Sheets to another Workbook Nelson M Excel Programming 2 January 16th 04 03:01 PM


All times are GMT +1. The time now is 11:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"