Msgbox question

P

Pancho

Is it possible I can obtain the Msgbox-button text?
If you issue a msgbox command like:
Msgbox "Question", vbDefaultButton1 + vbYesNoCancel

in a English Excel it will be displayed like the following:


Title: Microsoft Excel
Text: Question
Buttons: <Yes> <No> <Cancel>

but in Spanish Excel it will be displayed like this:

Title: Microsoft Excel
Text: Question
Buttons: <Si> <No> <Cancelar>

I need the text Yes,No,Cancel or Si,No,Cancelar, previous
to the issuing of the message box, because my "Text" has
that text on it.

Thanks
Francisco Mariscal

fcomariscal at hotmail dot com
 
H

Harald Staff

Hi Francisco

I think that is close to impossible from what I've seen on newsgroups like
"microsoft.public.win32.programmer.international".

But if english, spanish and maybe a few other languages are what you need;
you can obtain Excel's language version with
Application.International(xlCountryCode) and do a select case ti decide
which message to use. Determining Windows' (=Application.OperatingSystem)
language version is far trickier, but see
http://www.microsoft.com/globaldev/drintl/columns/009/default.mspx#Q4
 
J

jaf

Hi Pancho,
If you only have a few strings to deal with you can do something like this.

'in a public module
Dim MyLangID As String, MyStrings(2) As String

Sub test()
Set objLangSet = Application.LanguageSettings

If objLangSet.LanguageID(msoLanguageIDInstall) = 1033 Then
MyLangID = "English"
MyStrings(0) = "Question"
MyStrings(1) = "Error"
Else
MyLangID = "Español "
MyStrings(0) = "Pregunta"
MyStrings(1) = "Error"
End If
Debug.Print MyLangID, MyStrings(0), MyStrings(1)
End Sub

Sub anywhere()
Msgbox MyString(0), vbDefaultButton1 + vbYesNoCancel

End Sub
 
P

pancho

Jose, Gracias por contestar, lo que tengo es un letrero
que le pide al usuario :
Archivo Ya existe desea crear uno Nuevo?
<Yes> para crear uno nuevo borrando el anterior
<No> para abrir el archivo anterior y usarlo
<Cancel> para Cancelar y no hacer nada

pero esos letreros de Yes, No, Cancel debo poder
cambiarlos dependiendo del idioma del Excel (Es una rutina
con usuarios, Brasileños, Norteamericanos, españoles e
Italianos)
Y el mensaje esta usando actualmente una instruccion
MsgBox, por eso necesito saber que palabras usa Excel en
cada uno de los idiomas para ponerle a los botones de
YesNOCancel,
Y queria ver si es posible saberlo directamente de los
botones?

Gracias
Francisco Mariscal
fcomariscal at hotmail dot com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top