ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB Macro Menu in two different languages (https://www.excelbanter.com/excel-programming/423418-vbulletin-macro-menu-two-different-languages.html)

David Langschied

VB Macro Menu in two different languages
 
I have a VB macro inside of an Excel spreadsheet. To run the macro, I have
created a Menu selection that is situated right before "Help". In my code a
look for the index value of the help menu and place my menu before it ...

iHelpMenu = _
cbMainMenuBar.Controls("?").Index
..
..
..
Set cbcCutomMenu = _
cbMainMenuBar.Controls.Add(Type:=msoControlPopup, _
Befo=iHelpMenu)
cbcCutomMenu.Caption = "&Level Load"

I now need to do this for Latin-Spanish users. The help menu in this
language is "?", so my macro does not work. I could just figure out the
number that "Help" is and not bother specifying it, but that would mess
someone else up if they have custom menus.


So, my question is: How can I figure out the Language of the user first and
apply my menu selection as an if...else statement?

David

Ron de Bruin

VB Macro Menu in two different languages
 
Use the ID of the Help menu

Sub test()
MsgBox Application.CommandBars("Worksheet Menu Bar").FindControl(ID:=30010).Index
End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Langschied" wrote in message
...
I have a VB macro inside of an Excel spreadsheet. To run the macro, I have
created a Menu selection that is situated right before "Help". In my code a
look for the index value of the help menu and place my menu before it ...

iHelpMenu = _
cbMainMenuBar.Controls("?").Index
.
.
.
Set cbcCutomMenu = _
cbMainMenuBar.Controls.Add(Type:=msoControlPopup, _
Befo=iHelpMenu)
cbcCutomMenu.Caption = "&Level Load"

I now need to do this for Latin-Spanish users. The help menu in this
language is "?", so my macro does not work. I could just figure out the
number that "Help" is and not bother specifying it, but that would mess
someone else up if they have custom menus.


So, my question is: How can I figure out the Language of the user first and
apply my menu selection as an if...else statement?

David



David Langschied

VB Macro Menu in two different languages
 
This was perfect!

Thank you so much!

The Tech Net community, as always, came through!



"Ron de Bruin" wrote:

Use the ID of the Help menu

Sub test()
MsgBox Application.CommandBars("Worksheet Menu Bar").FindControl(ID:=30010).Index
End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Langschied" wrote in message
...
I have a VB macro inside of an Excel spreadsheet. To run the macro, I have
created a Menu selection that is situated right before "Help". In my code a
look for the index value of the help menu and place my menu before it ...

iHelpMenu = _
cbMainMenuBar.Controls("?").Index
.
.
.
Set cbcCutomMenu = _
cbMainMenuBar.Controls.Add(Type:=msoControlPopup, _
Befo=iHelpMenu)
cbcCutomMenu.Caption = "&Level Load"

I now need to do this for Latin-Spanish users. The help menu in this
language is "?", so my macro does not work. I could just figure out the
number that "Help" is and not bother specifying it, but that would mess
someone else up if they have custom menus.


So, my question is: How can I figure out the Language of the user first and
apply my menu selection as an if...else statement?

David





All times are GMT +1. The time now is 06:08 PM.

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