L
LEU
I am replacing the first page of my old document with the first page of our
new template. My macro below is not working right. It deletes the old footers
and the old first page but it inserts all the pages of the new template. I
tried putting a bookmark at the end of the first page of the new template and
in my range put in the bookmark so it read as follows but that did not work.
I tried the bookmark on both sides of the page break with no success. What am
I doing wrong?
objRange.InsertFile FileName:="C:\Procedure Master2.dot", _
Range:="bkpg1", ConfirmConversions:=False, Link:=False, _
Attachment:=False
The other problem I’m having is on some of the computers here at work when I
try to run this macro I get the following run-time error: ‘5941’ The
requested member of the collection does not exist. When I run debug it on the
following line:
Selection.Bookmarks("\Page").Range.Delete
When I run this macro on my computer here at work or at home I never get
this error.
Here is my macro:
Dim objSection As Section
Dim objRange As Range
Dim objHeaderFooter As HeaderFooter
' Delete all footers from each section
For Each objSection In ActiveDocument.Sections
For Each objHeaderFooter In objSection.Footers
objHeaderFooter.Range.Delete
Next objHeaderFooter
Next objSection
' Create a range for the start of the document
Selection.Bookmarks("\Page").Range.Delete
Set objRange = ActiveDocument.Range
objRange.End = objRange.Start
objRange.InsertFile FileName:="C:\Master2.dot", _
Range:="", ConfirmConversions:=False, Link:=False, _
Attachment:=False
new template. My macro below is not working right. It deletes the old footers
and the old first page but it inserts all the pages of the new template. I
tried putting a bookmark at the end of the first page of the new template and
in my range put in the bookmark so it read as follows but that did not work.
I tried the bookmark on both sides of the page break with no success. What am
I doing wrong?
objRange.InsertFile FileName:="C:\Procedure Master2.dot", _
Range:="bkpg1", ConfirmConversions:=False, Link:=False, _
Attachment:=False
The other problem I’m having is on some of the computers here at work when I
try to run this macro I get the following run-time error: ‘5941’ The
requested member of the collection does not exist. When I run debug it on the
following line:
Selection.Bookmarks("\Page").Range.Delete
When I run this macro on my computer here at work or at home I never get
this error.
Here is my macro:
Dim objSection As Section
Dim objRange As Range
Dim objHeaderFooter As HeaderFooter
' Delete all footers from each section
For Each objSection In ActiveDocument.Sections
For Each objHeaderFooter In objSection.Footers
objHeaderFooter.Range.Delete
Next objHeaderFooter
Next objSection
' Create a range for the start of the document
Selection.Bookmarks("\Page").Range.Delete
Set objRange = ActiveDocument.Range
objRange.End = objRange.Start
objRange.InsertFile FileName:="C:\Master2.dot", _
Range:="", ConfirmConversions:=False, Link:=False, _
Attachment:=False