View Single Post
  #7   Report Post  
Willllllll Willllllll is offline
Junior Member
 
Posts: 0
Default

Hey Klaus, you saved my day...! In my phd thesis, a part of the text showed up as strange symbols... Copy + paste to the notepad didn't work. After using your macro, everything is fine again :-D. But I wonder why this happened, and what kind of surprises in Microsoft Word are still waiting for me...
In the macro you posted, every equal sing ('=') seems to be replaced by a '=3D', so this has to be fixed before it works.

All the best,
William

Quote:
Originally Posted by Klaus Linke View Post
Hi Bob,

You'll only see the problem after you saved and reopened the file.

Hi JR,

Below's a macro to fix the text. It changes it to Arial. It'd be nicer =
to change it to the style's font, but that would require a much slower =
macro. You'd need to fix the font yourself as neccessary.

Regards,
Klaus


Sub FixTextAccidentallyUsingDecorativeFonts2()
' Should fix text that has been accidentally formatted
' in a decorative font, and change it to "Arial".
Dim myRange As Range
Dim myStoryRange As Range
For Each myStoryRange In ActiveDocument.StoryRanges
Set myRange =3D myStoryRange.Duplicate
Call FixText2(myRange)
MsgBox myStoryRange.Text, , myStoryRange.StoryType
While Not (myStoryRange.NextStoryRange Is Nothing)
Set myStoryRange =3D myStoryRange.NextStoryRange
Set myRange =3D myStoryRange.Duplicate
Call FixText2(myRange)
MsgBox myStoryRange.Text, , myStoryRange.StoryType
Wend
Next myStoryRange
End Sub

Sub FixText2(myRangeOld As Range)
' myRange needed because a bug(?) in Word2003
' always takes me to footnote separator StoryRange?!?
Dim myRange As Range
Do
Set myRange =3D myRangeOld.Duplicate
With myRange.Find
.ClearFormatting
.Text =3D "[" & ChrW(&HF000) & "-" & ChrW(&HF0FF) & "]"
.Forward =3D True
.Wrap =3D wdFindContinue
.MatchWildcards =3D True
If .Execute Then
With myRange.Find
.Text =3D "^u" & Trim(str(AscW(myRange.Text) And &HFFFF&))
.Replacement.Text =3D ChrW(AscW(myRange.Text) - &HF000)
.Replacement.Font.Name =3D "Arial"
.Forward =3D True
.Wrap =3D wdFindContinue
.MatchWildcards =3D False
End With
myRange.Find.Execute Replace:=3DwdReplaceAll
Else
Exit Do
End If
End With
Loop
End Sub



"JR" wrote
=20
Thanks for the suggestion. When I transferred the text to=20
Notepad, it came
out as gibberish - all squares. I have been able to=20
transfer to other
symbol-based text fonts, just not Arial, Times NewRoman,=20
Palatino, etc.

=20


"Opinicus"
wrote:
Interesting. Can you point me to a symbol-based font that I=20
can download on the internet? Wingdings is apparently not a=20
symbol-based font and I want to explore this problem.
=20
--=20
Bob
=20
Kanyak's Doghouse
http://www.kanyak.com
=20