2

I am designing a vba userform for excel 2013, in which I use English and Persian text, the problem is when I use a mix of both languages in a msgBox the bits of text come out in the wrong order, the number is supposed to be displayed at the end. here is the code:

Private Sub CommandButton1_Click()
   MsgBox "نام" & " - " & "نام" & " - " & "VF" & " - " & 52 & " ." _
   , 1 + 1048576 + 524288, "نام برگه"
End Sub

The parts in double quotes and the number are supposed to come from listBoxes.(I just replaced them here with examples, the code behaves the same) I tried spacing the bits out(works in windows), rearranging the bits and changing msgBox's alignment and reading order, but the result was the same. How to fix this thing?

  • I just tried and it seems that VBA automaticly align the text to the right when you have some persian. I inserted a `Chr(13)` after the persian part and the order is respected but text is still on the right (even if you start with English or non persian text)... – R3uK Apr 20 '15 at 11:38

1 Answers1

0

Could you put all the persian into a string. Have the message box output the string and then have the message box output the numbers?

So it would be something like

aString = ListBox1.value & "-" & listbox2.Value ....

msgbox aString & 52 etc...
Sam
  • 940
  • 3
  • 13
  • 32
  • I just tried it, still the same result, I don't know how useful it could be but I also tried this: ` Note1 = ListBox4.Text & " - " & ListBox5.Text Note2 = " - " & ListBox6.Text Note3 = " - " & TextBox1.Text MsgBox Note1 & Note2 & Note3, 1 + 1048576 + 524288, "نام برگه ی جدید"` Only to see the same result, the text from two first listboxes are in Persian , Listbox6 holds English,(VF, MVF like) and the textbox holds numbers – Soheyl Rahnama Apr 26 '15 at 06:17