Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Gilgamesh
 
Posts: n/a
Default Isolating a custom toolbar to a specific spreadsheet

I've created some macros and a custom toolbar to activate them but I want
these to only exist in a single spreadsheet.
I used the Customize-Attach feature to move my toolbar into the relevant
spreadsheet and then deleted it from the main list.

The problem I'm getting is that when I open the spreadsheet with the toolbar
it seems to copy it back into the main Excel app and it is then available
for all spreadsheets I open. Clicking on the buttons when another
spreadsheet is open then opens my customised one to run the macros.

I don't want this situation. When I close my customised sreadsheet file I
want the toolbar to disappear and not affect anything else.

I'm using Excel 2003, and helpful suggestions would be appreciated.

Thanks.


  #2   Report Post  
neopolitan
 
Posts: n/a
Default


Here is a way to do what you want, there may be others.

Instead of creating a toolbar with all your button on it( it will
always reside in the top of the screen independent of what spreadsheet
file you have open); in the file where you want your macro buttons to
reside, create a textbox for each one - you can assign a macro to a
textbox. The text boxes can only reside within the spreadsheet (they
sit on top of the cells so you will be losing access to some cells).
You can enter what ever text you want to identify the macro and even
color the text and the background to make it stand out from the cells.

Make sure that when you save your macros (for this workbook only) that
you specify "For this workbook". If you already have macros created in
a module under the Personal.xls workbook; you will have to copy and
paste the code into new modules in the specific workbook you want them
in and then delete them from the Personal.xls module list.


--
neopolitan


------------------------------------------------------------------------
neopolitan's Profile: http://www.excelforum.com/member.php...nfo&userid=611
View this thread: http://www.excelforum.com/showthread...hreadid=475781

  #3   Report Post  
Gilgamesh
 
Posts: n/a
Default

"neopolitan" wrote
in message ...

Here is a way to do what you want, there may be others.

Instead of creating a toolbar with all your button on it( it will
always reside in the top of the screen independent of what spreadsheet
file you have open); in the file where you want your macro buttons to
reside, create a textbox for each one - you can assign a macro to a
textbox. The text boxes can only reside within the spreadsheet (they
sit on top of the cells so you will be losing access to some cells).
You can enter what ever text you want to identify the macro and even
color the text and the background to make it stand out from the cells.

Make sure that when you save your macros (for this workbook only) that
you specify "For this workbook". If you already have macros created in
a module under the Personal.xls workbook; you will have to copy and
paste the code into new modules in the specific workbook you want them
in and then delete them from the Personal.xls module list.


If all else fails I will look at doing this as a workaround.
You have pointed out the advantage of toolbars in that they are available in
every worksheet within the file in question whereas with this option I'll
have to copy the textbox onto every sheet..



--
neopolitan


------------------------------------------------------------------------
neopolitan's Profile:
http://www.excelforum.com/member.php...nfo&userid=611
View this thread: http://www.excelforum.com/showthread...hreadid=475781



  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

First, I wouldn't attach the toolbars to the workbook. I'd build that toolbar
each time the workbook opened (and delete it each time the workbook closed).

Here's how I do it:
http://groups.google.co.uk/groups?th...5B41%40msn.com

If you want to add items to the worksheet menu bar, you can use John
Walkenbach's menumaker:
http://j-walk.com/ss/excel/tips/tip53.htm

And after you have that done, if you really want to make sure that the macro
only works against worksheets in that workbook, you have at least a couple of
choices.

#1. Modify the code for each macro:
near the top of each subroutine
if activeworkbook.name < thisworkbook.name then
'msgbox "no, no, no"
exit sub
end if

#2. Use some workbook events to hide/delete the toolbar whenever you change
workbooks.

workbook_deactivate and workbook_activate would seem to fit nicely.

I went to google groups and searched for workbook_deactivate. I sorted the
results by date and found this thread:

http://groups.google.co.uk/group/mic...f7dde5a0477be9

or

http://snipurl.com/iiye

J.E. McGimpsey's code even suggests using the attached toolbars.

Gilgamesh wrote:

I've created some macros and a custom toolbar to activate them but I want
these to only exist in a single spreadsheet.
I used the Customize-Attach feature to move my toolbar into the relevant
spreadsheet and then deleted it from the main list.

The problem I'm getting is that when I open the spreadsheet with the toolbar
it seems to copy it back into the main Excel app and it is then available
for all spreadsheets I open. Clicking on the buttons when another
spreadsheet is open then opens my customised one to run the macros.

I don't want this situation. When I close my customised sreadsheet file I
want the toolbar to disappear and not affect anything else.

I'm using Excel 2003, and helpful suggestions would be appreciated.

Thanks.


--

Dave Peterson
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
Custom toolbar and macros MD Excel Discussion (Misc queries) 2 May 10th 05 05:31 PM
How do I save a custom toolbar? Art Kaufman Excel Discussion (Misc queries) 4 April 3rd 05 08:13 PM
How can I attach a custom toolbar to only appear on one specific . ABuia Excel Worksheet Functions 1 January 18th 05 02:57 PM
I would like to delete a custom toolbar from the workspace. How? twiga Setting up and Configuration of Excel 1 December 23rd 04 05:55 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 01:08 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"