Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Setting Onaction for File Save on Menu bar using item or index numbers

I cannot seem to be able to set the onaction property of the File
Save item on the worksheet menubar using index numbers.


Application.CommandBars("File").Controls("Save").O nAction = "SaveFile"

works fine but if I want to do it as follows I get an error message

Application.CommandBars(1).Controls(3).OnAction = "SaveFile"

I am trying to use this method since using names for the controlbar
and controls causes a problem if the workbook is used on a spanish
version of excel.

Also, I seem to be also have a problem with the use of decimals
between english and spanish. In the spanish version the decimal is a
comma and my code interpretes 1.234 as 1,234 or a number one thousand
times greater than it is supposed to be. Is there a work around for
this issue?


David
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting Onaction for File Save on Menu bar using item or index numbers

? commandbars(1).Name
Worksheet Menu Bar
? commandbars(1).Controls(3).Caption
&View


You need to use the ID to find the commandbar.

first find out the ID:

? commandbars("File").Controls("Save").Id
3

now you can use that to get a reference to the control:
set bar = commandbars.FindControl(ID:=3)
? bar.caption
&Save

Just be aware that some controls can appear on multiple commandbars, so you
may need to do additional searching and checking.

--
Regards,
Tom Ogilvy


"David Cuthill" wrote in message
om...
I cannot seem to be able to set the onaction property of the File
Save item on the worksheet menubar using index numbers.


Application.CommandBars("File").Controls("Save").O nAction = "SaveFile"

works fine but if I want to do it as follows I get an error message

Application.CommandBars(1).Controls(3).OnAction = "SaveFile"

I am trying to use this method since using names for the controlbar
and controls causes a problem if the workbook is used on a spanish
version of excel.

Also, I seem to be also have a problem with the use of decimals
between english and spanish. In the spanish version the decimal is a
comma and my code interpretes 1.234 as 1,234 or a number one thousand
times greater than it is supposed to be. Is there a work around for
this issue?


David



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Setting Onaction for File Save on Menu bar using item or index numbers

Thank you for your help Tom - I was able to figure out
what to do. On a bigger related question what is the best
method for programming this type of language specific
stuff so that things work independant of the language that
is running on Excel?

Also do you have any thoughts on decimal "." versus ","
dilema?




-----Original Message-----
? commandbars(1).Name
Worksheet Menu Bar
? commandbars(1).Controls(3).Caption
&View


You need to use the ID to find the commandbar.

first find out the ID:

? commandbars("File").Controls("Save").Id
3

now you can use that to get a reference to the control:
set bar = commandbars.FindControl(ID:=3)
? bar.caption
&Save

Just be aware that some controls can appear on multiple

commandbars, so you
may need to do additional searching and checking.

--
Regards,
Tom Ogilvy


"David Cuthill" wrote in

message
. com...
I cannot seem to be able to set the onaction property

of the File
Save item on the worksheet menubar using index numbers.


Application.CommandBars("File").Controls

("Save").OnAction = "SaveFile"

works fine but if I want to do it as follows I get an

error message

Application.CommandBars(1).Controls(3).OnAction

= "SaveFile"

I am trying to use this method since using names for

the controlbar
and controls causes a problem if the workbook is used

on a spanish
version of excel.

Also, I seem to be also have a problem with the use of

decimals
between english and spanish. In the spanish version the

decimal is a
comma and my code interpretes 1.234 as 1,234 or a

number one thousand
times greater than it is supposed to be. Is there a

work around for
this issue?


David



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting Onaction for File Save on Menu bar using item or index numbers

VBA pretty much works in US English.

the only conflict I can see is if you are working with user entered text
strings.

so you can test and act accordingly:

? application.International(xlDecimalSeparator)
..
? application.International(xlThousandsSeparator)
,


--
Regards,
Tom Ogilvy

"David Cuthill" wrote in message
...
Thank you for your help Tom - I was able to figure out
what to do. On a bigger related question what is the best
method for programming this type of language specific
stuff so that things work independant of the language that
is running on Excel?

Also do you have any thoughts on decimal "." versus ","
dilema?




-----Original Message-----
? commandbars(1).Name
Worksheet Menu Bar
? commandbars(1).Controls(3).Caption
&View


You need to use the ID to find the commandbar.

first find out the ID:

? commandbars("File").Controls("Save").Id
3

now you can use that to get a reference to the control:
set bar = commandbars.FindControl(ID:=3)
? bar.caption
&Save

Just be aware that some controls can appear on multiple

commandbars, so you
may need to do additional searching and checking.

--
Regards,
Tom Ogilvy


"David Cuthill" wrote in

message
. com...
I cannot seem to be able to set the onaction property

of the File
Save item on the worksheet menubar using index numbers.


Application.CommandBars("File").Controls

("Save").OnAction = "SaveFile"

works fine but if I want to do it as follows I get an

error message

Application.CommandBars(1).Controls(3).OnAction

= "SaveFile"

I am trying to use this method since using names for

the controlbar
and controls causes a problem if the workbook is used

on a spanish
version of excel.

Also, I seem to be also have a problem with the use of

decimals
between english and spanish. In the spanish version the

decimal is a
comma and my code interpretes 1.234 as 1,234 or a

number one thousand
times greater than it is supposed to be. Is there a

work around for
this issue?


David



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting Onaction for File Save on Menu bar using item or index numbers

Stephen Bullen has put Chapter 22 of his book Excel 2002 VBA Programmer's
Reference on line. This is the definitive chapter on international issues.

http://www.oaltd.co.uk/ExcelProgRef/Default.htm

--
Regards,
Tom Ogilvy

"David Cuthill" wrote in message
...
Thank you for your help Tom - I was able to figure out
what to do. On a bigger related question what is the best
method for programming this type of language specific
stuff so that things work independant of the language that
is running on Excel?

Also do you have any thoughts on decimal "." versus ","
dilema?




-----Original Message-----
? commandbars(1).Name
Worksheet Menu Bar
? commandbars(1).Controls(3).Caption
&View


You need to use the ID to find the commandbar.

first find out the ID:

? commandbars("File").Controls("Save").Id
3

now you can use that to get a reference to the control:
set bar = commandbars.FindControl(ID:=3)
? bar.caption
&Save

Just be aware that some controls can appear on multiple

commandbars, so you
may need to do additional searching and checking.

--
Regards,
Tom Ogilvy


"David Cuthill" wrote in

message
. com...
I cannot seem to be able to set the onaction property

of the File
Save item on the worksheet menubar using index numbers.


Application.CommandBars("File").Controls

("Save").OnAction = "SaveFile"

works fine but if I want to do it as follows I get an

error message

Application.CommandBars(1).Controls(3).OnAction

= "SaveFile"

I am trying to use this method since using names for

the controlbar
and controls causes a problem if the workbook is used

on a spanish
version of excel.

Also, I seem to be also have a problem with the use of

decimals
between english and spanish. In the spanish version the

decimal is a
comma and my code interpretes 1.234 as 1,234 or a

number one thousand
times greater than it is supposed to be. Is there a

work around for
this issue?


David



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
in a excel file, how to make a menu item for the .xls file that when clicked on it runs myform.show? example plz Daniel Excel Worksheet Functions 1 July 7th 05 03:52 AM
Need Help with a Menu Item .OnAction property [email protected] Excel Programming 5 September 28th 04 03:19 AM
OnAction menu item property coding BrianB Excel Programming 1 July 13th 04 09:43 PM
Setting OnAction of custom menu item? Ed[_18_] Excel Programming 12 May 10th 04 02:55 PM
Disable File-Save menu item in macro? BrianG[_4_] Excel Programming 1 February 25th 04 06:48 PM


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"