Hi All,
I have a simple piece of code in a module on my Normal template:
Sub SearchString() Dim txt As String Dim newtxt As String txt = “Designation1/Designation2” newtxt = Replace(txt, “/”, vbCr) Selection.TypeText Text:=newtxt End Sub
Works beautifully. BUT, take this same code into another module on another template (AuthorDesignation has already been defined and is a simple string variable) and I get a compile error: expected array. This happens in Word 2010 and Word 2003. Try as I might, I cannot see a difference between the two.
If AuthorDesignation “” Then AuthorDesignation = Replace(AuthorDesignation, “/”, vbCr) ‘if the designation goes on to two lines Selection.TypeText Text:=vbCr & AuthorDesignation End If
I’m not trying to deal with an array at all – I just want to remove the character / from the text.
Any help would be appreciated.
Thank you.