R
Richard Cole
Hi
This may well be the wrong newsgroup, but hopefully you can point me to the
correct group if it is.
I've got a VB6 program that generates Word 2003 documents from templates.
The VB6 program uses a piece of code that loops through a program built
array and replaces the Variable name (Col 0 in the array) (which is already
in the template) with the replacement value (Col 1 in the array). This all
works fine. This is happening all in VB6 using Word.Application object
..Selection.Find.Execute Replace:=wdReplaceAll command in a loop for each
non-blank entry in the array.
with WrdApp
... Some code to control loop and set ActivePane Views
With .Selection.Find
.Text = ReplacementList(I, 0)
.Replacement.Text = ReplacementList(I, 1)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
' Replace all occurrences
.Selection.Find.Execute Replace:=wdReplaceAll
end with
But... When I need to replace a variable with multiple paragraphs, I am
creating ReplacementList (x,1) using the predefined vbCr (or Chr$(13)) as
my paragraph breaker
(i.e
ReplacementList (x,0) = "##VariableToReplace##"
ReplacementList (x,0) = "Sentence 1" & vbCr & "Sentence 2"
), but this is generates a 'Soft Enter' (like Shift + Enter), so is not
creating new lines correctly in bulleted or number lists and when in a
style with a defined spacing before each paragraph, the inter-paragraph
spacing is being lost.
I've tried using the predefined vbCrLf (vbCr & vbLf) but this just puts in
an unrecognised character box.
I need to know the ASCII value of the 'Hard Enter' (what would be ^p in a
Word search replace), so that I can get these document formatted correctly.
Many thanks in advance.
Richard
This may well be the wrong newsgroup, but hopefully you can point me to the
correct group if it is.
I've got a VB6 program that generates Word 2003 documents from templates.
The VB6 program uses a piece of code that loops through a program built
array and replaces the Variable name (Col 0 in the array) (which is already
in the template) with the replacement value (Col 1 in the array). This all
works fine. This is happening all in VB6 using Word.Application object
..Selection.Find.Execute Replace:=wdReplaceAll command in a loop for each
non-blank entry in the array.
with WrdApp
... Some code to control loop and set ActivePane Views
With .Selection.Find
.Text = ReplacementList(I, 0)
.Replacement.Text = ReplacementList(I, 1)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
' Replace all occurrences
.Selection.Find.Execute Replace:=wdReplaceAll
end with
But... When I need to replace a variable with multiple paragraphs, I am
creating ReplacementList (x,1) using the predefined vbCr (or Chr$(13)) as
my paragraph breaker
(i.e
ReplacementList (x,0) = "##VariableToReplace##"
ReplacementList (x,0) = "Sentence 1" & vbCr & "Sentence 2"
), but this is generates a 'Soft Enter' (like Shift + Enter), so is not
creating new lines correctly in bulleted or number lists and when in a
style with a defined spacing before each paragraph, the inter-paragraph
spacing is being lost.
I've tried using the predefined vbCrLf (vbCr & vbLf) but this just puts in
an unrecognised character box.
I need to know the ASCII value of the 'Hard Enter' (what would be ^p in a
Word search replace), so that I can get these document formatted correctly.
Many thanks in advance.
Richard