I have created an RTF file for my online Help. I don't have any problems creating the Help file. Now I want to create a manual, but I don't want to retype everything. I have converted the file from .RTF to .DOC, but all the formats (#K and double underline) are kept. The printout doesn't look good, as you can imagine.
Can anyone tell me the best way to do what I want to do? It is too much work stepping through the document and eliminating the stuff I don't want to be displayed. It is enough replacing all references to the bitmap I have used.
Sonja Al-Kass
Germany
Piece o' cake, Sonja! This conversion is simple when you become familiar with WordBasic. The code below should be used as a macro in Word for Windows 6.0 and then executed on the desired document. The macro looks for any text that has the "Footnote Reference" style. Whenever this text is found, it is deleted from the document using the EditClear command. It then looks for any double-underlined and underlined text. These characteristics are removed using the EditReplaceFont command.
Sub MAIN
StartOfDocument
EditFindClearFormatting
EditFindStyle .Style = "Footnote Reference"
EditFind .Find = "", .Direction = 0, .MatchCase = 0, .WholeWord = 0,
.PatternMatch = 0, .SoundsLike = 0, .Format = 1, .Wrap = 0
'Remove all Footnote References.
'WARNING: This may be a different name in German WinWord.
While EditFindFound()
If Len(Selection$()) Then
EditClear
EndIf
EditFind .Find = "", .Direction = 0, .MatchCase = 0, .WholeWord = 0,
.PatternMatch = 0, .SoundsLike = 0, .Format = 1, .Wrap = 0
Wend
'Remove all Double Underline.
EditFindClearFormatting
EditReplaceClearFormatting
EditFindStyle .Style = ""
EditFindFont .Points = "", .Underline = 3, .Color = - 1,
.Strikethrough = - 1, .Superscript = - 1, .Subscript = - 1,
.Hidden = - 1, .SmallCaps = - 1, .AllCaps = - 1, .Spacing = "",
.Position = "", .Kerning = - 1, .KerningMin = "", .Tab = "0",
.Font = "(normal text)", .Bold = - 1, .Italic = - 1, .Outline = - 1,
.Shadow = - 1
EditReplaceFont .Points = "", .Underline = 0, .Color = - 1,
.Strikethrough = - 1, .Superscript = - 1, .Subscript = - 1,
.Hidden = - 1, .SmallCaps = - 1, .AllCaps = - 1, .Spacing = "",
.Position = "", .Kerning = - 1, .KerningMin = "", .Tab = "0",
.Font = "(normal text)", .Bold = - 1, .Italic = - 1, .Outline = - 1,
.Shadow = - 1
EditReplace .Find = "", .Replace = "", .Direction = 0, .MatchCase = 0,
.WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll,
.Format = 1, .Wrap = 2
'Remove all Single Underline.
EditFindFont .Points = "", .Underline = 1, .Color = - 1,
.Strikethrough = - 1, .Superscript = - 1, .Subscript = - 1, .Hidden = - 1,
.SmallCaps = - 1, .AllCaps = - 1, .Spacing = "", .Position = "",
.Kerning = - 1, .KerningMin = "", .Tab = "0", .Font = "(normal text)",
.Bold = - 1, .Italic = - 1, .Outline = - 1, .Shadow = - 1
EditReplaceFont .Points = "", .Underline = 0, .Color = - 1,
.Strikethrough = - 1, .Superscript = - 1, .Subscript = - 1, .Hidden = - 1,
.SmallCaps = - 1, .AllCaps = - 1, .Spacing = "", .Position = "",
.Kerning = - 1, .KerningMin = "", .Tab = "0", .Font = "(normal text)",
.Bold = - 1, .Italic = - 1, .Outline = - 1, .Shadow = - 1
EditReplace .Find = "", .Replace = "", .Direction = 0, .MatchCase = 0,
.WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll,
.Format = 1, .Wrap = 2
End Sub
The process could be further extended to replace the "{bm? filename}" reference with the actual pictures. This is done in the following macro.
Sub MAIN
D$ = InputBox$("Enter the directory where the images are located", "Replace
{bm...}", "C:\VB3\HC\")
If Len(D$) Then
If Right$(D$, 1) <> "\" Then D$ = D$ + "\"
Endif
StartOfDocument
EditFind .Find = "{bm", .Direction = 0, .MatchCase = 0, .WholeWord = 0,
.PatternMatch = 0, .SoundsLike = 0, .Format = 1, .Wrap = 0
While EditFindFound()
While Right$(Selection$(), 1) <> "}"
CharRight 1, 1
Wend
bmp$ = LTrim$(RTrim$(LCase$(Mid$(Selection$(), 6,
Len(Selection$()) - 6))))
If Right$(bmp$, 3) = "shg" Then
bmp$ = Left$(bmp$, Len(Bmp$) - 3) + "bmp"
End If
On Error Resume Next 'In case file not found or invalid (i.e. shg).
InsertFile$ = D$ + bmp$
InsertPicture .Name = InsertFile$, .LinkToFile = "0"
On Error Goto 0
CharRight 1
EditFind .Find = "{bm", .Direction = 0, .MatchCase = 0, .WholeWord = 0,
.PatternMatch = 0, .SoundsLike = 0, .Format = 1, .Wrap = 0
Wend
End Sub