Foreign Language Issues with commands

MPW

Well-known Member
Joined
Oct 7, 2009
Messages
571
Office Version
  1. 365
Platform
  1. Windows
Hey All,

Problem using English VBA commands on systems that use another language. For instance 'Russian or Mandarin'

The following is an example of one of the problems we are encountering.
Code:
                       'English         English
Application.CommandBars("[B]Cell[/B]").Controls("[B]Copy[/B]").Enabled = False

I was able to find the ID numbers for the menu items so change the code to this:
Code:
'                               Was able to change the Copy command. 
Application.CommandBars("Cell").FindControl(ID:=19).Enabled = False

I found the commandbar ID number for the cell commandbar was 423

My question is what is the command to select the commandbar with it's ID number?

Thanks for the time.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I think that I have the Commandbar ID numbers. Where I am stuck is how to write the statement.


You did get me thinking of a side question. Do these ID numbers stay the same across different versions of Office? Example: 2003 vs 2010

Thank you for the input.
 
Upvote 0
I found the answer to the question of numerical commands between Office 2003 vs 2010.
There is really only one that might cause problems for someone.

PasteSpecial which (of course) is located in multiple commandbars. In 2003 it is (ID:=755) and in 2010 it is (ID:=21437)

If anyone is interested in see the whole list let me know and I will upload it.

I still have not figured out how to write the command structure for selecting the menu and command by using their numerical equivalents. If anyone has any insight into this it would be greatly appreciated.


MPW
 
Upvote 0
Question: How do I use the information retrieved from Excel to handle commands with just numerical values? And how many Values are needed?

Using this code I can retieve all the Values:
Code:
    Dim cbCtl As CommandBarControl
    Dim cbBar As CommandBar
    Dim i As Integer
    i = 2
    For Each cbBar In CommandBars
        i = i + 1
        For Each cbCtl In cbBar.Controls
            Cells(i, 1) = cbBar.Name
            Cells(i, 2) = cbBar.ID
            Cells(i, 3) = cbCtl.Caption
            Cells(i, 4) = cbCtl.ID
            i = i + 1
        Next cbCtl
    Next cbBar

Here is the information for the area I wish to affect.

The CommandBar Name = "Built in Menus"
The CommandBar ID# = "143"
The Control Name = "&Edit"
The Control ID# = "30003"

The Control ID# for Copy is "19"

Now I want to disable the copy command from the Built in Menus but not the Cell Menu.

This command will disable the Copy command in both the Built in Menus and the Cell Menus, but it is still using the English word "Edit to name the CommandBar.
Code:
Application.CommandBars("Edit").FindControl(ID:=19).Enabled = False

This will completely disable the whole Built in Menu Edit option. which is not what I want at all.
Code:
Application.CommandBars.FindControl(ID:=30003).Enabled = False

What I need is a way to specify which menu to affect as well as the individual control. This must be done using the the numerical value so that the application can be used on systems with or without English as the primary language.

I hope this makes more sense. Thanks for the look.
 
Upvote 1
Hi gang, still me.

I would also like to know if there is any impact to VBA in general when dealing with systems using foreign languages (outside of the menus that the previous posts are referring to.). I do know that there could potentially be some date issues.


I assumed that VBA is a language in it's own right even though it uses English conventions such as (If Then); (Do While); etc.
It would not use the German word for 'If' or 'Then'. Is this correct?


MPW
 
Upvote 0
Hey All,

Since I have had only one reply so far on this question, (by the way thank you HTH for the info), I guess I need to explore other ways around the problem.

I would really rather avoid making a chart that would convert the menu items on the fly by checking for installed languages. I think that would be a huge undertaking and need a lot of maintenance.

Another option would be to try to globally disable the commands. This however would not work well. Like a sniper using a shotgun;) The same could be said for disabling whole menus to disable one command on that menu. I think I would be shooting myself in the foot with this method.

I really can not think of any other options at the moment.

I still think if someone knew how to write the statement with numerical refs in place of both the menu and the command it would be the best answer.

I am open to any other methods of doing this that I have not thought of.

Thanks
 
Upvote 0
Upvote 0
As far as I know, the commandbar names remain the same (the index numbers change between versions) but it's best to identify the controls by id number.
 
Upvote 0
Again, Thank you HTH for more reading! It might take me a while to get through it all but definitely worth it.
 
Upvote 0

Forum statistics

Threads
1,215,324
Messages
6,124,249
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top