ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Tools For Office - Excel Menus (https://www.excelbanter.com/excel-programming/283986-tools-office-excel-menus.html)

Troy[_5_]

Tools For Office - Excel Menus
 

Using Tools for Office, does anyone know how to create
Cascading menus (menus within menus) for Excel?

Also does anyone know how to create right-
click/context/short-cut menus (if it is possible) for
Excel?

Thanks.

Chip Pearson

Tools For Office - Excel Menus
 
Troy,

Are you talking about the Visual Studio Tools For Office? You
create menu items there in very much the same way as you do in
VBA. For example,

Friend MenuCtrl As Office.CommandBarControl ' this goes on the
Tools menu

Private WithEvents MenuItem1 As Office.CommandBarButton 'this
goes under the control

Private WithEvents MenuItem2 As Office.CommandBarButton 'this
goes under the control


Try
MenuCtrl =
Me.ThisApplication.CommandBars.FindControl(ID:=cTO OLS_MENU).Contr
ols.Add _
(Type:=Office.MsoControlType.msoControlPopup,
temporary:=True)
MenuCtrl.Tag = cMENU_TAG
MenuCtrl.Caption = "Office NET Tools"

MenuItem1 = MenuCtrl.Controls.Add()
MenuItem1.Caption = "1. Show Modal Form"
MenuItem1.Tag = cMENU_TAG

MenuItem2 = MenuCtrl.Controls.Add()
MenuItem2.Caption = "2. Show Modeless Form"
MenuItem2.Tag = cMENU_TAG
Catch ex As Exception
MessageBox.Show ("Error creating menu items: " & vbCrLf & _
ex.Message)
End Try



You can custom the right-click menu by adding controls to the
"Cell" menu.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Troy" wrote in message
...

Using Tools for Office, does anyone know how to create
Cascading menus (menus within menus) for Excel?

Also does anyone know how to create right-
click/context/short-cut menus (if it is possible) for
Excel?

Thanks.




No Name

Tools For Office - Excel Menus
 

Thanks. Excuse my ignorance, but how do you add the items
to the "cell" menu (ie how do you get a handle on
the "Cell" menu)

Thanks again.


-----Original Message-----
Troy,

Are you talking about the Visual Studio Tools For

Office? You
create menu items there in very much the same way as you

do in
VBA. For example,

Friend MenuCtrl As Office.CommandBarControl ' this goes

on the
Tools menu

Private WithEvents MenuItem1 As

Office.CommandBarButton 'this
goes under the control

Private WithEvents MenuItem2 As

Office.CommandBarButton 'this
goes under the control


Try
MenuCtrl =
Me.ThisApplication.CommandBars.FindControl

(ID:=cTOOLS_MENU).Contr
ols.Add _
(Type:=Office.MsoControlType.msoControlPopup,
temporary:=True)
MenuCtrl.Tag = cMENU_TAG
MenuCtrl.Caption = "Office NET Tools"

MenuItem1 = MenuCtrl.Controls.Add()
MenuItem1.Caption = "1. Show Modal Form"
MenuItem1.Tag = cMENU_TAG

MenuItem2 = MenuCtrl.Controls.Add()
MenuItem2.Caption = "2. Show Modeless Form"
MenuItem2.Tag = cMENU_TAG
Catch ex As Exception
MessageBox.Show ("Error creating menu items: " &

vbCrLf & _
ex.Message)
End Try



You can custom the right-click menu by adding controls

to the
"Cell" menu.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Troy" wrote in message
...

Using Tools for Office, does anyone know how to create
Cascading menus (menus within menus) for Excel?

Also does anyone know how to create right-
click/context/short-cut menus (if it is possible) for
Excel?

Thanks.



.


Chip Pearson

Tools For Office - Excel Menus
 
Troy,

Use
Dim CmdBar As Office.CommandBar
CmdBar = Me.ThisApplication.CommandBars("Cell")

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
...

Thanks. Excuse my ignorance, but how do you add the items
to the "cell" menu (ie how do you get a handle on
the "Cell" menu)

Thanks again.


-----Original Message-----
Troy,

Are you talking about the Visual Studio Tools For

Office? You
create menu items there in very much the same way as you

do in
VBA. For example,

Friend MenuCtrl As Office.CommandBarControl ' this goes

on the
Tools menu

Private WithEvents MenuItem1 As

Office.CommandBarButton 'this
goes under the control

Private WithEvents MenuItem2 As

Office.CommandBarButton 'this
goes under the control


Try
MenuCtrl =
Me.ThisApplication.CommandBars.FindControl

(ID:=cTOOLS_MENU).Contr
ols.Add _
(Type:=Office.MsoControlType.msoControlPopup,
temporary:=True)
MenuCtrl.Tag = cMENU_TAG
MenuCtrl.Caption = "Office NET Tools"

MenuItem1 = MenuCtrl.Controls.Add()
MenuItem1.Caption = "1. Show Modal Form"
MenuItem1.Tag = cMENU_TAG

MenuItem2 = MenuCtrl.Controls.Add()
MenuItem2.Caption = "2. Show Modeless Form"
MenuItem2.Tag = cMENU_TAG
Catch ex As Exception
MessageBox.Show ("Error creating menu items: " &

vbCrLf & _
ex.Message)
End Try



You can custom the right-click menu by adding controls

to the
"Cell" menu.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Troy" wrote in message
...

Using Tools for Office, does anyone know how to create
Cascading menus (menus within menus) for Excel?

Also does anyone know how to create right-
click/context/short-cut menus (if it is possible) for
Excel?

Thanks.



.




Shetty

Tools For Office - Excel Menus
 
You can custom the right-click menu by adding controls to the
"Cell" menu.


I have created the control on the right-click menu which runs a macro
for the selected cells. But this control is not available (control
button fades up) when entire raws or column is selected. Code is as
below.

Sub My_Format()

CommandBars("Cell").Reset

With CommandBars("Cell")
With .Controls.Add
.FaceId = 20
.Caption = "My Format"
.OnAction = "form"
End With
End With

End Sub

Thanks,
Shetty

Chip Pearson

Tools For Office - Excel Menus
 
Shetty,

The command bars shown when you select an entire row or column
are called "Row" and "Column". You would have to add your
controls to those command bars as well.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Shetty" wrote in message
om...
You can custom the right-click menu by adding controls to the
"Cell" menu.


I have created the control on the right-click menu which runs a

macro
for the selected cells. But this control is not available

(control
button fades up) when entire raws or column is selected. Code

is as
below.

Sub My_Format()

CommandBars("Cell").Reset

With CommandBars("Cell")
With .Controls.Add
.FaceId = 20
.Caption = "My Format"
.OnAction = "form"
End With
End With

End Sub

Thanks,
Shetty




Shetty

Tools For Office - Excel Menus
 
Thanks Chip.
I have repeated the same statements with the row and column replacing
cell and it works as expected.
Thanks again.
Shetty.


"Chip Pearson" wrote in message ...
Shetty,

The command bars shown when you select an entire row or column
are called "Row" and "Column". You would have to add your
controls to those command bars as well.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Shetty" wrote in message
om...
You can custom the right-click menu by adding controls to the
"Cell" menu.


I have created the control on the right-click menu which runs a

macro
for the selected cells. But this control is not available

(control
button fades up) when entire raws or column is selected. Code

is as
below.

Sub My_Format()

CommandBars("Cell").Reset

With CommandBars("Cell")
With .Controls.Add
.FaceId = 20
.Caption = "My Format"
.OnAction = "form"
End With
End With

End Sub

Thanks,
Shetty



All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com