PDA

View Full Version : Word macro will not work



FoxyMX
24-03-2006, 05:04 PM
I am trying to add an old macro to Word XP/2002 for formatting email text (ie it removes all the > marks and wonky line spacing) but it is not working. Can anyone see what the problem is please? Below are the instructions that I have been following to create the macro:



Word 6 and 7

Macro Creation Instructions

Select the macro text below, between the Sub Main and End Sub lines and copy it to the clipboard by pressing <Ctrl>-C
Select Tools, Macro,
Type fixmail in the Macro Name field of the Macro dialog box, and click Create.
Press <Ctrl>-V to paste the macro text into the macro.
Select File, Close and click Yes when prompted to save the changes in the macro.


Sub MAIN

dowhat = 1
If SelType() = 2 Then
dowhat = 0
End If

EditReplace .Find = "^p", .Replace = "@@@", .Direction = 0, .ReplaceAll, .Wrap = dowhat
EditReplace .Find = "@@@@@@", .Replace = "^p^p", .Direction = 0, .ReplaceAll, .Wrap = dowhat
EditReplace .Find = "@@@", .Replace = " ", .Direction = 0, .ReplaceAll, .Wrap = dowhat

End Sub



Thanks. :)

Parry
24-03-2006, 05:59 PM
The problem is that those old commands are no longer valid because the code is now using Visual Basic for Applications not Word Basic. If your in the VB Editor and select the help topic "Visual Basic Equivalents for WordBasic Commands" it describes what the new equivalents are.

I'll see if I can work it out for you - Im not sure what ^P is representing etc so I would need to understand that.

Parry
24-03-2006, 06:22 PM
Found some code which seems to be just a recorded macro so is a lot longer that it needs to be but see if it does the job.
http://www.livinginternet.com/e/et_format_fix_macro.htm

The first line Application.Move Left:=342, Top:=7 will cause an error and is crap anyway so remove that line.

hth

FoxyMX
24-03-2006, 06:25 PM
Thanks Parry but don't go to any trouble trying to get it to work as it isn't that important - I can always install my older version of Word if I want to.

I was just wondering whether there may have been a quick fix somewhere as I didn't realise that things had changed a lot.

Thanks anyway. :)


Edit: Oops, didn't see your latest reply until after I posted. I will check that out later on and let you know how it goes. Thanks. :)