Jim, sorry not to reply before. I missed your message first time around amongst the voting slips! Thanks for the note about StrReverse() - that's cool, since I'm using VBA 6.0 (apparently). However, I guess my real problem is that I have no idea how I would select a block of text and then run the macro in such a way that sForward takes the value of the selected text, then have the macro replace the selected text with sReversed! My hazy memory says that once upon a time there were commands like GET and PUT (not, maybe, in VBA!), but I think, somehow, programming moved on a bit since then. I think maybe I need to start from the ground up and really learn VBA, rather than messing around like a tourist with a phrasebook! Andrew > -----Original Message----- > From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx]On > Behalf Of Jim Pettit > Sent: 10 June 2004 14:17 > To: mso@xxxxxxxxxxxxx > Subject: [mso] Re: Word [2000]: Macro to reverse text L-R > > > Andrew-- > > You seem to be mostly on track. > > VBA 6.0 -- which is the version used by Office 2000 -- contains an > intrinsic (built-in) function called StrReverse, which does what your > function does, but quicker, and can be used without declaration. Just > call it where needed. > > Here's a *very* simple call as you'd use it: > > Dim sForward As String > Dim sReversed As String > > sForward = "The effect I want is that every line is reversed" > sReversed = StrReverse(sForward) > > When run, sReversed would be "desrever si enil yreve taht si tnaw I > tceffe ehT", the desired result. > > You don't necessarily need to feed each line one at a time; you can pass > it entire paragraphs, or pages, or even a whole document. It all depends > on what effect you'd like to achieve. > > NOTE: If you're using VBA 5.0 or lower, you would obviously need to use > something like your function. If so, place it in a module, and do indeed > declare it Public in scope so you can use it throughout your > application. It would be use the same way as the newer intrinsic > function. The function you showed will work, but just for fun, here's > the version I used to use: > > Public Function StrReverse(Expression As String) As String > Dim i As Integer, j As Integer, S As String > S = Expression > i = 1 > For j = Len(S) To 1 Step -1 > Mid$(S, i, 1) = Mid$(Expression, j, 1) > i = i + 1 > Next j > StrReverse = S > End Function > > Hope this helps... > > --Jim > ************************************************************* You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or MicrosoftOffice@xxxxxxxxxxxxxxxx To send mail to the group, simply address it to mso@xxxxxxxxxxxxx To Unsubscribe from this group, send an email to mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in the subject line. Or, visit the group's homepage and use the dropdown menu. This will also allow you to change your email settings to digest or vacation (no mail). //www.freelists.org/webpage/mso To be able to use the files section for sharing files with the group, send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with instructions. Once you are a member of the files group, you can go here to upload/download files: http://www.smartgroups.com/vault/msofiles *************************************************************