MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 13th, 2002, 12:04 AM   #1
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Thanks for the help...

Several of the controls on a custom command bar have macros assigned to them...
When I re-open this template after having saved a copy as a workbook, the commandbar's control's, which have assigned macros, now refer to the saved workbook and not the template.
I'm losing hair on this one.
Thanks for the replies...
Tom
Tom Schreiner is offline   Reply With Quote
Old May 13th, 2002, 12:15 AM   #2
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

Tom, I always try to create commandbars on the fly, that is, create them on the Workbook_Open and delete them on Workbook_BeforeClose.

I saw a while ago a suggestion that I think can work for you, in the Workbook_Open they made sure that each button pointed to the Active Workbook, not the original Workbook. I imagine that this is done by setting the OnAction property of each button.

Hope that helps
__________________
Regards,

Juan Pablo González
http://www.juanpg.com
Juan Pablo González is online now   Reply With Quote
Old May 13th, 2002, 12:17 AM   #3
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

I'll try it out
Thanks Juan.
Tom
Tom Schreiner is offline   Reply With Quote
Old May 13th, 2002, 12:46 AM   #4
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Juan, you are a genius!



Option Explicit

Private Sub Workbook_Open()
Dim MyCustomBar, MyCustomBarControl
Set MyCustomBar = Application.CommandBars("SOSE Outcomes")
Application.CommandBars("SOSE Outcomes").Enabled = True
For Each MyCustomBarControl In MyCustomBar.Controls
Select Case MyCustomBarControl.Caption
Case "Paste to My Class"
MyCustomBarControl.OnAction = "SOSECutPaste"
Case "4 outcomes per page"
MyCustomBarControl.OnAction = "RH90"
Case "3 outcomes per page"
MyCustomBarControl.OnAction = "RH120"
End Select
Next
Application.CommandBars("SOSE Outcomes").Visible = True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("SOSE Outcomes").Visible = False
Application.CommandBars("SOSE Outcomes").Enabled = False
End Sub



Works perfectly!
This is actually for Chookers.
I will let him/her know.
Thanks!
Tom
Tom Schreiner is offline   Reply With Quote
Old May 13th, 2002, 12:48 AM   #5
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

Great ! I would still prefer to create that commandbar on the fly !
__________________
Regards,

Juan Pablo González
http://www.juanpg.com
Juan Pablo González is online now   Reply With Quote
Old May 13th, 2002, 04:46 PM   #6
chookers
Board Regular
 
Join Date: Mar 2002
Posts: 115
Default

Mr T thank you so much for that, yes I will thank Juan for sure. Will try it out as soon as I get out of class. I did actually read Ivan's reply before BUT I just didn't know enough to understand it! I am slowly getting there, sorry Ivan.

Now for a really stupid question. For me to create the custom bars on the fly, what exactly does that mean? If anyone can clarify I will certainly do that, and in any case I'd love to know.

Mr. T thanks so much, and Ivan and Juan!!!
Cheers!
chookers is offline   Reply With Quote
Old May 13th, 2002, 09:03 PM   #7
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Chookers, I have never created a custom bar with code, but I have seen plenty of reference to it in VBA help and at Microsofts MSDN site. Start there and then post if you need help with the finer points.
Tom
Tom Schreiner is offline   Reply With Quote
Old May 14th, 2002, 04:26 AM   #8
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-13 15:46, chookers wrote:
Mr T thank you so much for that, yes I will thank Juan for sure. Will try it out as soon as I get out of class. I did actually read Ivan's reply before BUT I just didn't know enough to understand it! I am slowly getting there, sorry Ivan.

Now for a really stupid question. For me to create the custom bars on the fly, what exactly does that mean? If anyone can clarify I will certainly do that, and in any case I'd love to know.

Mr. T thanks so much, and Ivan and Juan!!!
Cheers!
Hi Chookers if theres something you don't
understand then just ask, someone will always
try and reply/help no matter what the Q.

Creating a commandbar on the fly just means
CREATING your custom commandbar when your
workbook opens. When your workbook is closed
it gets DELETED, not hidden. If it is just
hidden/not visible then you can potentially
still have a reference to this book that could be called up again.

There are plenty of examples on the Net, and
I have used this a bit.

Have a look here for the MenuMk

http://www.j-walk.com/ss/excel



Examples: Have a look @ this;


__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 11:13 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes