Recorded macro causing syntax error

Copper Contributor

I record a macro in Word (Office 365 single user). 

When I run the macro it provokes a syntax error in VBasic.

 

The macro replaces all occurrences of a [full stop (period) followed by end-of-line] with a [full stop followed by vertical bar].

 

In other words replace .^p with .|

 

Office translates this into the following snippet of VBasic:

 

Sub inline()

'

' inline Macro

'

'

Selection.Find.ClearFormatting

Selection.Find.Replacement.ClearFormatting

With Selection.Find

.Text Dialog "."

.Replacement.Text Dialog ""  < this provokes Microsoft Visual Basic compile error syntax error

.Forward Dialog True

.Wrap Dialog wdFindContinue

.Format Dialog False

.MatchCase Dialog False

.MatchWholeWord Dialog False

.MatchWildcards Dialog False

.MatchSoundsLike Dialog False

.MatchAllWordForms Dialog False

End With

Selection.Find.ClearFormatting

Selection.Find.Replacement.ClearFormatting ... etc

 

Do you know how to fix this?

It worked perfectly on all previous editions of Word. I installed Office 365 yesterday and note that it wiped out ALL my recorded macros.

0 Replies