PC Review


Reply
Thread Tools Rate Thread

Customized menues

 
 
eggpap
Guest
Posts: n/a
 
      20th Dec 2007
How to preserve the customized menues from one PC to another?

Emiliano


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      20th Dec 2007
Build them dynamically


Here is an example

Private Sub Workbook_Open()
Dim oCb As CommandBar
Dim oCtl As CommandBarPopup
Dim oCtlBtn As CommandBarButton

Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl = .Controls("Tools").Controls.Add( _
Type:=msoControlPopup, _
temporary:=True)
oCtl.Caption = "myButton"
With oCtl
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton, _
temporary:=True)
oCtlBtn.Caption = "myMacroButton"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myMacro"
End With
With oCtl
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton, _
temporary:=True)
oCtlBtn.Caption = "myMacroButton2"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myMacro2"
End With
'etc.
End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim oCb As CommandBar

Set oCb = Application.CommandBars("Worksheet Menu Bar")
oCb.Controls("Tools").Controls("myButton").Delete
End Sub

To add this, go to the VB IDE (ALT-F11 from Excel), and in
the explorer pane, select your workbook. Then select the
ThisWorkbook object (it's in Microsoft Excel Objects which
might need expanding). Double-click the ThisWorkbook and
a code window will open up. Copy this code into there,
changing the caption and action to suit.

This is part of the workbook, and will only exist with the
workbook, but will be available to anyone who opens the
workbook.



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"eggpap" <(E-Mail Removed)> wrote in message
news:476ab05b$0$16030$(E-Mail Removed)...
> How to preserve the customized menues from one PC to another?
>
> Emiliano
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
there are too many context menues =?Utf-8?B?VGltb3RoeQ==?= Microsoft Word Document Management 7 28th May 2006 04:19 AM
Menues with v1.1? UJ Microsoft ASP .NET 5 10th Oct 2005 08:20 PM
Toolbars & Menues David Sparks Microsoft Outlook 0 31st Aug 2004 08:55 PM
cascading menues with asp.net Yavuz Bogazci Microsoft ASP .NET 1 25th Jul 2003 02:47 PM
Re: Building Menues... Steve C. Orr, MCSD Microsoft ASP .NET 0 1st Jul 2003 07:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:11 AM.