Back to jkp-ads.com |
Ron de Bruin
|
Ron de Bruin decided to remove all Windows Excel content from his website for personal reasons. If you want to know why, head over to rondebruin.nl.
Luckily, Ron was kind enough to allow me to publish all of his Excel content here.
Most of these pages are slightly outdated and may contain links that don 't work. Please inform me if you find such an error and I'll try to fix it.
Kind regards
Jan Karel Pieterse
The first thing I suggest you should do is read the "International
Issues" chapter from the following link:
Excel 2002 VBA
Programmer's Reference
Written by John Green, Stephen Bullen,
Rob Bovey and Robert Rosenberg
http://www.oaltd.co.uk/ExcelProgRef/Ch22/default.htm
Note: see also the other pages about International Excel Issues on my site.
If you want to add a menu item or disable a Command bar or Menu/Control
you must always use the English name of the Command bar in the code. If you
use the local name of the Command bar it is not working. But for a
Menu/Control you must use the local name (to make it easy <g>).
To
avoid problems use the Menu/Control Id's instead of the captions of the
Menu/Controls
This is not working in a non English version to disable
the File menu
Application.CommandBars("Worksheet
Menu Bar").Controls("File").Enabled = False
This is always
working :
Application.CommandBars("Worksheet Menu
Bar").FindControl(ID:=30002).Enabled = False
Because there is
only one control with the ID 30002 you can use this line also because
FindControl will find the first occurrence of the ID.
Application.CommandBars.FindControl(ID:=30002).Enabled
= False
See this page for more examples and how you can find
all the Id's
Disable Command bars and Controls in Excel 97-2003
To apply Excel 2007's new built-in styles with code you must use the
style name of the local language. This presents difficulties if you do not
know the user's language version. For example this code will only work for
English users:
Selection.Style = "Bad"
The workaround is to apply the style to a cell that will never change.
This could be a hidden cell in the workbook you are working with, or in any
open workbook, even in an Addin. It does not matter which language version
the style was originally applied with. When the file is loaded in the user's
system
the style name will update to the equivalent name in the user's
language.
The following example assumes cell A1 of the active-sheet
had been applied with
your given style, let's say with the style named "Bad",
or the equivalent in any language:
Selection.Style = Range("A1").Style
If A1 is not on the
active-sheet you will need to qualify it with its parent Worksheet and
possibly workbook. You may find it easier to define a Name for this cell,
and call it say "StyleBad"
Selection.Style = Range("StyleBad").Style
After you run the
workaround Dutch, German and French users, for example,
will find
"Ongeldig", "Schlecht" and "Insatisfaisant" respectively.