N
Nick Transier
When I reach a caption text under a picture in my document, I copy the
picture, paste it into a new document, and then rename the new document with
the caption text. In order to do this I have to find and replace any illegal
characters (for save purposes) in the caption text eg ":"
First Question: How do I alter the selection text for the purpose of
formatting a file name without actually changing the text in the document.
For example, I select a caption: "Figure 1: Example Caption" and I want to
find/replace so that the file name is "Figure 1.Example Caption", but I do
not want the actual word document to change. I have a similar problem with
converting a table to text for export, but then the table has been changed
in the actual document which I do not want.
Second question: Can I search for several things at once and replace with
one character or do I need to repeat the following statement for everything:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ":" <------------- i.e. can I
put several selections here?
.Replacement.Text = "."
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
picture, paste it into a new document, and then rename the new document with
the caption text. In order to do this I have to find and replace any illegal
characters (for save purposes) in the caption text eg ":"
First Question: How do I alter the selection text for the purpose of
formatting a file name without actually changing the text in the document.
For example, I select a caption: "Figure 1: Example Caption" and I want to
find/replace so that the file name is "Figure 1.Example Caption", but I do
not want the actual word document to change. I have a similar problem with
converting a table to text for export, but then the table has been changed
in the actual document which I do not want.
Second question: Can I search for several things at once and replace with
one character or do I need to repeat the following statement for everything:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ":" <------------- i.e. can I
put several selections here?
.Replacement.Text = "."
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll