Running Letterhead macro for pages 5 & 6 only

  • Thread starter HERSCHEL R. ELKINS JR.
  • Start date
H

HERSCHEL R. ELKINS JR.

I currently have a 6 page document that gets inserted, then completed
via userform.
(Userform1:)
If SelectFile.Text = "EMAN.DEFDR.FRM.doc" Then
ActiveDocument.Variables("EMAN.DEFDR.FRM").Value = True
Selection.InsertFile "R:\Eman.defDR.frm.doc"
With ActiveDocument.Sections.First.PageSetup
.TopMargin = InchesToPoints(0.5)
.BottomMargin = InchesToPoints(0.5)
End With
End If

The last 2 pages are letters, and I have been struggling to get the
letterhead macro to run on these pages only. I have tried inserting a
bookmark, then telling it to run the macro at that point, only to have
it put letterhead on every page but the first.
(Userform2:)
Private Sub CommandButton1_Click()
If ActiveDocument.Variables("EMAN.DEFDR.FRM") = True Then
With ActiveDocument
.Bookmarks("BMSTCN").Range _
.InsertBefore UFSTCN1
(whole lot more of insert bookmark)
.Bookmarks("BMP5LH").Application.Run ("Letterhead")
End With
End If

After many failures I experimented with section breaks. It seemed that
no matter where a section break was, or what type, I would always get
"Value out of range."
(Userform2:)
Private Sub CommandButton1_Click()
If ActiveDocument.Variables("EMAN.DEFDR.FRM") = True Then
With ActiveDocument
.Bookmarks("BMSTCN").Range _
.InsertBefore UFSTCN1
(whole lot more of insert bookmark)
End With
ActiveDocument.Sections(2).Application.Run "LetterHead"
End If


Any Suggestions?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top