PDA

View Full Version : How can I invert text in a macro?



iddoav
01-08-2009, 12:01 PM
Hey,
I want to write a macro that inverts the text in a paragraph.
meaning this paragraph:
"test my macro 123"

will become"
"321 orcam ym tset"

Is there any way of accessing the paragraph as an array?

thanks!

Oorang
01-08-2009, 12:07 PM
msgbox StrReverse("test my macro 123")

iddoav
01-08-2009, 12:23 PM
Thanks,
But the problem is selecting the text that is already in the word document.

lucas
01-08-2009, 12:42 PM
So use the selection:
MsgBox StrReverse(Selection)

iddoav
01-08-2009, 12:50 PM
Wow! so easy :)
thank you.

I created:
Selection.TypeText Text:=StrReverse(Selection)

fumei
01-08-2009, 01:20 PM
You can do it more simply as:

Selection = StrReverse(Selection)



Warning! Warning!

Be VERY careful using anything like this with a Selection that is in a table. It may have some unexpected results. If you want to do something like this in a table, use a Range object.