G
Gary Hillerson
I'm trying to figure out something that's pretty easy, but I'm semi
brain dead at this point and can't see how:
I have a function that works fine and inserts a new page at the end of
the current section, then adds a couple paragraphs, something like
this:
Function DoPageInsert(headingStyleName, theHeadingText) as Range
With Selection
.EndOf unit:=wdSection
.Collapse Direction:=wdCollapseEnd
.InsertBreak Type:=wdSectionBreakNextPage
.InsertParagraph
.Style = headingStyleName
.InsertBefore theHeadingText
.Collapse Direction:=wdCollapseEnd
Set DoPageInsert = Selection.Range
End With
I then call that function (which works fine) to create a new page, and
then insert the contents of a file into that page:
Set rng = DoPageInsert("TestStyle", "MyText")
rng.Select
with Selection
.Collapse Direction := wdCollapseStart
.InsertFile FileName;= "myFileName", _
ConfirmConversions:=False, Link:=False, _
Attachment:=False
....
end With
THE PROBLEM: at this point, I want to search through the page, i.e.
through the content I just inserted from the file.I don't know how to
get a range or selection that represents just that text. I can jump to
the top of my page, but I don't know how to create a range that
encompasses what i just inserted.
Any help?
thanks in advance,
gary hillerson
brain dead at this point and can't see how:
I have a function that works fine and inserts a new page at the end of
the current section, then adds a couple paragraphs, something like
this:
Function DoPageInsert(headingStyleName, theHeadingText) as Range
With Selection
.EndOf unit:=wdSection
.Collapse Direction:=wdCollapseEnd
.InsertBreak Type:=wdSectionBreakNextPage
.InsertParagraph
.Style = headingStyleName
.InsertBefore theHeadingText
.Collapse Direction:=wdCollapseEnd
Set DoPageInsert = Selection.Range
End With
I then call that function (which works fine) to create a new page, and
then insert the contents of a file into that page:
Set rng = DoPageInsert("TestStyle", "MyText")
rng.Select
with Selection
.Collapse Direction := wdCollapseStart
.InsertFile FileName;= "myFileName", _
ConfirmConversions:=False, Link:=False, _
Attachment:=False
....
end With
THE PROBLEM: at this point, I want to search through the page, i.e.
through the content I just inserted from the file.I don't know how to
get a range or selection that represents just that text. I can jump to
the top of my page, but I don't know how to create a range that
encompasses what i just inserted.
Any help?
thanks in advance,
gary hillerson