PDA

View Full Version : Solved: Langauge problems



ukdane
12-03-2008, 04:39 AM
So,
I've created my program, and people are now testing it.
BUT I've already run into a problem.

Most of my users are running an "English" version of Excel 2003.
However one or two are begining to switch to a different language version.
In this case, a Danish version of Excel 2003.
This is causing a problem.

The problem is that the Menu and Toolbar functions only look for English text, and I need them to also operate for Danish Menus and Toolbars.
Is there a way that Excel can search for the language settings, and set up the menu and toolbars according to language?

iHelpMenu = cbMainMenuBar.Controls("Help").Index
cbMainMenuBar.Controls.Add(Type:=msoControlButton, Before:=iHelpMenu).Caption = "About"
cbMainMenuBar.Controls("About").Style = msoButtonCaption
cbMainMenuBar.Controls("About").OnAction = "showabout"
This code places an ABOUT button to the left og the HELP index. In the Danish version "HELP" is replaced with "HJ?LP"

Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Reviewing").Visible = False
Hides the relevant toolbars- I want to hide ALL the toolbars, except for my own custom toolbar.
Again in Danish, the toolbars are called something else.
If I just add the Danish equivalent, then I get an error in the English version, and the English toolbars cause an error in the Danish version.
How to I solve this conflict?


Thanks for helping!

Jan Karel Pieterse
12-03-2008, 05:40 AM
You should use the Id of the commandbars and commandbarcontrols rather than the caption.

See my tool xlmenufundict.zip on www.jkp-ads.com/download.asp (http://www.jkp-ads.com/download.asp) (bottom of page) for a complete listing of them.

ukdane
12-03-2008, 06:10 AM
Jan,
Thanks I'm still not sure how to implement the ID.

For example, accroding to your file, "Help" has the ID: 30010.

How would I use that in:


iHelpMenu = cbMainMenuBar.Controls("Help").Index
cbMainMenuBar.Controls.Add(Type:=msoControlButton, Before:=iHelpMenu).Caption = "About"
cbMainMenuBar.Controls("About").Style = msoButtonCaption
cbMainMenuBar.Controls("About").OnAction = "showabout"


Also, for the toolbars, they don't appear to have a specific id, only the English name.
How do I utilise that?

Bob Phillips
12-03-2008, 06:20 AM
Set cbMainMenuBar = Application.CommandBars(1)
iHelpmenu = cbMainMenuBar.FindControl(ID:=30010).Index
cbMainMenuBar.Controls.Add(Type:=msoControlButton, Before:=iHelpmenu).Caption = "About"
cbMainMenuBar.Controls("About").Style = msoButtonCaption
cbMainMenuBar.Controls("About").OnAction = "showabout"

ukdane
12-03-2008, 06:56 AM
Thanks xld. :-)

ukdane
01-12-2009, 05:40 AM
Just a quick question about this again:

cbMainMenuBar.Controls(ID:=30011).Enabled = False

I need to turn off the Data menu function in a workbook (and turn it on again later), but the above code doesn't work.
Originally it read as: cbMainMenuBar.Controls("Data").Enabled = False 'Data which worked fine, but I have users working with different languages, so need to use the ID, not the string.

How do I get this to work?

Bob Phillips
01-12-2009, 05:57 AM
Application.Commandbars.FindControl(ID:=30011).Enabled = False

ukdane
01-12-2009, 06:12 AM
Perfect, thanks.