Share via

Macros in word problem

Anonymous
2013-07-03T04:26:16+00:00

I am basically attempting to create a vba macros in word 2011. The thing is, that my macros has cyrillic letters in it. The integrated VBA editor doesn't accept cyrillic. Instead of them the editor displays some unknown characters. This looks like a bug, but maybe someone had the same problem and fixed it somehow. I did call the Microsoft support. After being redirected to different support departments I ended up in pro support and all they said was their support costs 250$ and without payment they can't help me.

On my work pc I have a russian installation of office 2003 and everything works just fine there. I attempted to use macros on other computers with non russian offices on them and the editor just rejects russian letters.

This is the macro

Sub TestMacro()

With ActiveDocument.Tables(1)

For r = .Rows.Count To 1 Step -1

fnd = False

For Each c In .Rows(r).Cells

If InStr(c.Range.Text, "text") > 0 Then fnd = True

Next

If fnd Then .Rows(r).Delete

Next

End With

End Sub

Instead of the word "text" I want to put in some russian characters, but instead I get something completely wrong.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-07-03T08:31:40+00:00

Yes, this is a problem with the VBA editor (it's not just Mac).

One workaround is to express the string using ChrW() functions, e.g. for text you would use

ChrW(116) & ChrW(101) & ChrW(120) & ChrW(116)

To convert the characters you want into an expression like that, you could

a. type the text you want into a Word document, and select the text

b. run the following VBA code

c. copy/paste the expression from the Immediate Window inthe VB Editor into your code.

Sub createChrWExpressionFromSelection()

Dim i As Integer

For i = 1 To Len(Selection)

If i > 1 Then

Debug.Print " & ";

End If

Debug.Print "ChrW(" & CStr(AscW(Mid(Selection, i, 1))) & ")";

Next

End Sub

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful