
07-12-2011, 07:27 AM
|
Novice
|
|
Join Date: Apr 2011
Posts: 27
|
|
Hi Paul,
Thanks for the modified code.
This is what I wanted, the code runs as expected. Just for one portion of the code “Design Requirements” is not as expected.
Quote:
“If UCase(Sctn.Range.Sentences.First) Like "#*DESIGN REQUIREMENTS*" Then”
|
Code:
'Check for Design Requirements in the source document
For Each Sctn In .Sections
If UCase(Sctn.Range.Sentences.First) Like "#*DESIGN REQUIREMENTS*" Then
Set Rng = Sctn.Range
'Cut the 'Design Requirement' Section from the
'source document and paste it into a new references document
Rng.Cut
Set DocDesReq = Documents.Add(Visible:=False)
'Process the new document
Call NewDoc(DocDesReq)
'Delete everything after the 'Design Requirement' Section
Rng.End = .Range.End
Rng.Delete
Exit For
End If
Next Sctn
This ‘#’ character does not seem to be a wildcard character in word 2007.
With this ‘#’ character in place the file is not created in the output folder.
When this ‘#’ character is removed I get the file in the output folder, but only 1 section that says ‘DESIGN REQUIREMENTS’, the other section that says ‘CONTROL DESIGN REQUIREMENTS’ is not created.
Playing around with it, when I use a space "* DESIGN REQUIREMENTS*" it creates the ‘CONTROL DESIGN REQUIREMENTS’ section but not the ‘DESIGN REQUIREMENTS’ section. Frankly, I tried all the wildcard characters with no success.
To get both sections into the output folder, I believe, there should be a solution. I am sure you will know the trick.
Thanks
FLDS
|