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 Mar 14th, 2002, 06:36 PM   #1
Dave
New Member
 
Join Date: Mar 2002
Location: Tennessee
Posts: 25
Default

Hello All:
I've made a production sheet for work that has several command buttons (View instructions, print and save, etc.). The problem I'm having is several of my coworkers seem to want to print the data entry sheet from the toolbar rather than use the command button to print the actual production sheet (this button also saves the workbook as their name + the day of the week).

My question:
Is there any way to change the function of the buttons on the standard toolbar (the print and the close window buttons in particular) only when this workbook is opened. I know I can at least remove the print button from the toolbar, but it stays removed when using excel for anything else (this workbook is shared on a network). Any advise would be welcome.

Thanks in advance

Dave
Dave is offline   Reply With Quote
Old Mar 14th, 2002, 06:52 PM   #2
Anne Troy
MrExcel MVP
 
Anne Troy's Avatar
 
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
Default

Welcome to MrExcel, Dave. You obviously have code that loads when you open the file. And you obviously know how to create code to take that button off. What you want to do in your code is then take your menu off and put that button back on in the Before_Close event.
__________________
~Anne Troy
Anne Troy is offline   Reply With Quote
Old Mar 15th, 2002, 05:09 AM   #3
Guest
 
Posts: n/a
Default

Hhhmmmm, hadn't thought of that one. Thanks Dreamboat Just for kicks though, is there any way to change the function of the button? Would be nice to have the print button open a message box and tell them to use the buttons on the form. I'm hoping that something along this line might make them more aware of the macro buttons.

Thanks Again

Dave
  Reply With Quote
Old Mar 15th, 2002, 05:26 AM   #4
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi Dave (great name)

try:


Sub DoiT()
Application.CommandBars("Worksheet menu bar").Controls("File").Controls("Print...").OnAction = "myMacro"
End Sub


Sub MyMacro()
MsgBox "I have desingned a button for this, USE IT!!"
End Sub

Sub PutBack()
Application.CommandBars("Worksheet menu bar").Reset
End Sub

BUT a word of warning, unless you use the correct Events (similar to tuggies suggestions) you will not win any friends with the network administrators. You should always return toolbars back to their normal state, not only when you close your Workbook, but also should the user activate another.

At the risk of scaring you off VBA for life I have an example of how this can be done here: http://www.ozgrid.com/VBA/ExcelWorkbookEvents.htm
It's designed for a custom toolbar, but it should get you started.



_________________
Kind Regards
Dave Hawley
OzGrid Business Applications
Microsoft Excel/VBA Training


[ This Message was edited by: Dave Hawley on 2002-03-15 04:27 ]
Dave Hawley is offline   Reply With Quote
Old Mar 16th, 2002, 06:28 PM   #5
Dave
New Member
 
Join Date: Mar 2002
Location: Tennessee
Posts: 25
Default

Wow, another Dave (imagine that

Thanks for the reference to that web page, I'll have to look real close at your code (seems to have lots of potenial for what I'm wanting to do).

Yes, I need to keep Admin happy at all costs!

As for scaring me off VBA, NO WAY! To much fun to play with

Thanks for the help.

Dave

Dave is offline   Reply With Quote
Old Mar 16th, 2002, 06:59 PM   #6
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

My pleasure Dave (I really like that name).

I have had a change of heart about system administrators, they don't deserve any friends
Dave Hawley is offline   Reply With Quote
Old Mar 17th, 2002, 07:32 AM   #7
Dave
New Member
 
Join Date: Mar 2002
Location: Tennessee
Posts: 25
Default

Ok Dave (boy that name just kinda stands out doesn't it):

I saw on your web site the code for extracting data from closed workbooks.

The question:
Can this code extract from more than one workbook? Since my production sheets all save as the operator name+dayoftheweek I would assume (and we know how that works) that I could use the day of the week as a key. I.e.: have one workbook with a command button to extract all the data from mondays (or what ever day of the week) production, compile it into one sheet, and print only one report vs. the 10-15 I get now (major paper and ink savings over time).
Seems to me that this would require a counter to advance the paste area on the open workbook (to avoid overwriting data), and a means to search for all the operator names (yes, i know you dislike loops, gesh I have yet to get one to even run right!). And if that weren't enough, it also needs the ways and means to search the cells on the Production_Sheet page of the closed workbooks to find only the one with values (I think I see an inkling of where to start with this).
Boy, talk aobut thinking yourself around the corner and down the road...kinda makes my brain hurt.

Any thoughts, hints or comments (maybe a good cussing?)

Thanks

Dave
p.s. Should I repost this as a new thread?


Dave is offline   Reply With Quote
Old Mar 23rd, 2002, 07:50 PM   #8
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi Dave

The link was to actually show you how to hide all commandBars on activating a Workbook containing a Custom Command bar. I see you have focused on the Extract from closed Workbook code!

In regards to overwriting existing data, I cannot see why, just pull the data in on a Hidden sheet then simply cut and paste it to the sheet that it should be on.

Sheets("MyHiddenSheet").UsedRange.Cut Destination:=Sheets("CorrectSheet").Range("A65536").end(xlup).offset(1,0)


For the problem of searching for the needed data, just pull the lot in, then use AutoFilter or Find (or if you must a loop) to get in data you need.


Dave Hawley 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 02:17 PM.


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