0

On this link I tried to detect the paste event but I have a problem related to my Excel language. In summary I must change this line:

lastAction = Application.CommandBars("Standard").Controls("&Undo").List(1)

into

lastAction = Application.CommandBars("Standard").Controls("&Annulla").List(1)

As you can see, the code is language related and so I will have problems if I use it in other excel versions. Is there a better way to identify the undo control?

If I will not have a better way I will use

Application.LanguageSettings.LanguageID(msoLanguageIDUI)

to select the right Control. Where can I find a list of LanguageID for excel 2010 (and is it differnt from later version)?

Community
  • 1
  • 1
brazoayeye
  • 329
  • 1
  • 2
  • 14

1 Answers1

2

Controls have unique ID's which you should use:

Application.CommandBars("Standard").findControl(id:=128,recursive:=true).List(1)

Download xlmenufundict from http://jkp-ads.com/download.asp for a list of id's per Office version.

jkpieterse
  • 2,727
  • 1
  • 9
  • 18
  • I must check the `Enabled` propriety to avoid problems before reading the first element. The problem now is that the `.List(1)` string is language related... Do you know how to solve it? – brazoayeye Oct 27 '17 at 15:57
  • I'm afraid not, the list being locally translated is not something we can change unfortunately. You might try comparing the value in the list with the caption of one of the paste buttons perhaps? – jkpieterse Oct 29 '17 at 11:58