B
bryan
I have a template which has a header and footer and the abiltiy with checkbox
to add another document which I update with information from our host systems.
This works well except I do not want the footer and header carried forward.
I cannot inset page as when renaming formfields it renames all. With a
section break it will only rename the formfields of that section added.
Here is an example of what I am doing:
Sub IDCard1()
‘ item is vehicle numbers loaded from formfield
For Each Item In array2
strInfo = getinfo(Item)
array3 = Split(strInfo, ",")
strrkst = array3(0)
strIDCard = "W:\Commercial\ MN Vehicle Insurance Identification Card.doc"
Set myDoc = ActiveDocument
myDoc.Unprotect
Set docrange = myDoc.Range
With docrange
.Collapse wdCollapseEnd
.InsertBreak wdSectionBreakNextPage
.Collapse wdCollapseEnd
.InsertFile strIDCard
End With
With myDoc.Sections.Last.Range
For z = 1 To .FormFields.Count
.FormFields(z).Name = "Unit" & Item & z
Next z
End With
myDoc.Protect wdAllowOnlyFormFields, NoReset
strvyr = array3(1)
strmake = array3(2)
strmodl = array3(3)
strvin = array3(4)
Stru = "Unit" & Item & 1
strv = "Unit" & Item & 2
ActiveDocument.FormFields(Stru).Result = strvyr & " " & strmake & " " &
strmodl
Next
End If
End Sub
How can I do this so as to not carry the header and footer with a section
break?
Thanks,
Bryan
to add another document which I update with information from our host systems.
This works well except I do not want the footer and header carried forward.
I cannot inset page as when renaming formfields it renames all. With a
section break it will only rename the formfields of that section added.
Here is an example of what I am doing:
Sub IDCard1()
‘ item is vehicle numbers loaded from formfield
For Each Item In array2
strInfo = getinfo(Item)
array3 = Split(strInfo, ",")
strrkst = array3(0)
strIDCard = "W:\Commercial\ MN Vehicle Insurance Identification Card.doc"
Set myDoc = ActiveDocument
myDoc.Unprotect
Set docrange = myDoc.Range
With docrange
.Collapse wdCollapseEnd
.InsertBreak wdSectionBreakNextPage
.Collapse wdCollapseEnd
.InsertFile strIDCard
End With
With myDoc.Sections.Last.Range
For z = 1 To .FormFields.Count
.FormFields(z).Name = "Unit" & Item & z
Next z
End With
myDoc.Protect wdAllowOnlyFormFields, NoReset
strvyr = array3(1)
strmake = array3(2)
strmodl = array3(3)
strvin = array3(4)
Stru = "Unit" & Item & 1
strv = "Unit" & Item & 2
ActiveDocument.FormFields(Stru).Result = strvyr & " " & strmake & " " &
strmodl
Next
End If
End Sub
How can I do this so as to not carry the header and footer with a section
break?
Thanks,
Bryan