Consulting

Results 1 to 8 of 8

Thread: Solved: Langauge problems

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Solved: Langauge problems

    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?
    [VBA]
    iHelpMenu = cbMainMenuBar.Controls("Help").Index
    cbMainMenuBar.Controls.Add(Type:=msoControlButton, Before:=iHelpMenu).Caption = "About"
    cbMainMenuBar.Controls("About").Style = msoButtonCaption
    cbMainMenuBar.Controls("About").OnAction = "showabout"[/VBA]
    This code places an ABOUT button to the left og the HELP index. In the Danish version "HELP" is replaced with "HJ?LP"

    [VBA]Application.CommandBars("Formatting").Visible = False
    Application.CommandBars("Standard").Visible = False
    Application.CommandBars("Reviewing").Visible = False[/VBA]
    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!

  2. #2
    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 (bottom of page) for a complete listing of them.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    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:
    [VBA]
    iHelpMenu = cbMainMenuBar.Controls("Help").Index
    cbMainMenuBar.Controls.Add(Type:=msoControlButton, Before:=iHelpMenu).Caption = "About"
    cbMainMenuBar.Controls("About").Style = msoButtonCaption
    cbMainMenuBar.Controls("About").OnAction = "showabout"
    [/VBA]

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

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    Thanks xld. :-)

  6. #6
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    Just a quick question about this again:

    [VBA]cbMainMenuBar.Controls(ID:=30011).Enabled = False [/VBA]

    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: [VBA]cbMainMenuBar.Controls("Data").Enabled = False 'Data[/VBA] 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?

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Application.Commandbars.FindControl(ID:=30011).Enabled = False
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location
    Perfect, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •