Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Create a toolbar button

I've been looking at the help, and other posts here long enough. What I
want seems simple, but maybe it's not.

I want to create a toolbar button.
I want to insert a macro inside this button.
I want this button to be there whenever I bring Excel up. Not specific
to any 1 file.

I've gone in the Tools/Customize are, and I've created a new Toolbar.
Ok, now what? I don't see anything to create a button for the toolbar.

Can anyone help?
Thanks,
J.O.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Create a toolbar button

Add this to your personal.xls workbook

'-----------------------------------------------------------------
Private Sub Workbook_Open()
'-----------------------------------------------------------------

On Error Resum Next
Application.CommandBars("Formatting").Controls("My Button")
On Error Goto 0

With Application.CommandBars("Formatting").Controls.Add
.BeginGroup = True
.Caption = "My Button"
.Style = msoButtonCaption
.OnAction = "myMac ro"
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"excelnut1954" wrote in message
oups.com...
I've been looking at the help, and other posts here long enough. What I
want seems simple, but maybe it's not.

I want to create a toolbar button.
I want to insert a macro inside this button.
I want this button to be there whenever I bring Excel up. Not specific
to any 1 file.

I've gone in the Tools/Customize are, and I've created a new Toolbar.
Ok, now what? I don't see anything to create a button for the toolbar.

Can anyone help?
Thanks,
J.O.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Create a toolbar button

Thanks for replying. Just where is the personal.xls workbook ?
I right clicked the icon as you suggested, but your instructions let me
to open up the current file's VBA editor.
I understand the concept of having this code executed each time Excel
loads, but I don't understand the personal workbook thing.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Create a toolbar button

Personal.xls is a workbook that is automatically loaded at startup,
assuming you store it in the XLStart directory, and is hidden by default. It
is a good place to store your application specific macros.

To create one, do this:
- menu ToolsMacroRecord New Macro...
- in the Store macro in dropdown, select Personal.xls
- click OK
- when the Recording toolbar pops up, just click the stop button

That's it, you will now have a Personal.xls, and when you go into the VBIDE,
you will see a Personal.xls project that you can add code to.


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"excelnut1954" wrote in message
oups.com...
Thanks for replying. Just where is the personal.xls workbook ?
I right clicked the icon as you suggested, but your instructions let me
to open up the current file's VBA editor.
I understand the concept of having this code executed each time Excel
loads, but I don't understand the personal workbook thing.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Create a toolbar button

Thanks Bob. I've seen references to Personal.xls, but didn't really
know what it was. Where would you put code there? In a standard module?
ThisWorkbook?
J.O.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Create a toolbar button

The code should be in this workbook because the event is workbook_open.

The macro that you want to be available might go in the module section.

Arun.

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
Create Toolbar Button Andy Excel Discussion (Misc queries) 3 December 31st 08 04:17 PM
Create a toolbar button based on three steps ChuckW Excel Discussion (Misc queries) 1 March 12th 08 05:30 PM
How do I create a customized toolbar button? Excell 2007 rllngriver Excel Discussion (Misc queries) 6 April 23rd 07 08:04 AM
create button in excel toolbar owl527[_8_] Excel Programming 8 February 1st 06 09:11 PM
How do I create a button on the toolbar that will start my form? DMB Excel Discussion (Misc queries) 0 January 8th 06 11:00 PM


All times are GMT +1. The time now is 09:15 PM.

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"