View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Minitman[_5_] Minitman[_5_] is offline
external usenet poster
 
Posts: 27
Default Add A Button To The Menu Bar When Opening Workbook

Thanks Dave,

That works Great.

Your help is greatly appreciated.

-Minitman



On Thu, 10 May 2007 07:37:20 -0500, Dave Peterson
wrote:

First, you got hit by a line wrap problem with Jeff's code.

But this may work for you. (Starting with Jeff's code.)

Option Explicit
Sub addbar()
Dim MenuItem As CommandBarButton
Set MenuItem = Application.CommandBars("Worksheet Menu Bar") _
.Controls.Add(Type:=msoControlButton, temporary:=True)
With MenuItem
'.Style = msoButtonIconAndCaption
.Style = msoButtonIcon
.FaceId = 59
'.Caption = "Caption Here"
.OnAction = "'" & thisworkbook.name & "'!" & "macronamehere"
.TooltipText = "Hi there"
End With
End Sub

If you're looking for some of the built-in icons:

Doug Clancy's:
http://www.dicks-blog.com/archives/2...-viewer-addin/

John Walkenbach's:
http://j-walk.com/ss/excel/tips/tip67.htm

Jim Rech's:
http://www.oaltd.co.uk/MVP/MVPPage.asp#JimRech



Minitman wrote:

Hey Dave,

Thanks for the reply. I did learn some things from this link, it's
just not what I am looking for.

I loaded this code and when I saw what it produced I realized that a
menu was is not what I am looking for. I also would like to avoid an
add-in.

I was hoping for just a button with only a tool tip instead of a
caption. The smiley face circles look ok when placed on the menu bar
manually. I just need them to be temporary (not on all of my
worksheets, only one).

Is there a way to do this with code?

Any help is appreciated.

-Minitman

On Wed, 09 May 2007 15:57:34 -0500, Dave Peterson
wrote:

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

Minitman wrote:

Greetings,

I need to place a button, with code, onto the menu bar when I open a
particular workbook from any machine in my network.

I can do it manually, but I can't figure out how to do it with code.

Any suggestions, ideas or possible links that could shed some light as
to how to proceed?

Any help is appreciated.

-Minitman