SOS
06-11-2008, 06:13 AM
Hi folks,
Working with code which adds a new doc via a template and then inserts another file and I want to change the margins (but just of the inserted file). I have the code:
Sub Add_Doc()
Documents.Add Template:= _
"C:\Assessment.dot", NewTemplate:=False, DocumentType:=0
With Selection
.EndKey Unit:=wdStory
.InsertBreak Type:=wdPageBreak
End With
With ActiveDocument.Range(Start:=Selection.Start, End:=ActiveDocument. _
Content.End).PageSetup
.TopMargin = CentimetersToPoints(1.3)
.BottomMargin = CentimetersToPoints(1.3)
.LeftMargin = CentimetersToPoints(1.5)
.RightMargin = CentimetersToPoints(1.5)
End With
Selection.InsertFile FileName:="SSA Form.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
End Sub
which SHOULD set margins from the PageBreak onwards but instead it is setting the margins for the whole document.
Can anyone point me in the right direction please?
As always any help is much appreciated
Seamus
Working with code which adds a new doc via a template and then inserts another file and I want to change the margins (but just of the inserted file). I have the code:
Sub Add_Doc()
Documents.Add Template:= _
"C:\Assessment.dot", NewTemplate:=False, DocumentType:=0
With Selection
.EndKey Unit:=wdStory
.InsertBreak Type:=wdPageBreak
End With
With ActiveDocument.Range(Start:=Selection.Start, End:=ActiveDocument. _
Content.End).PageSetup
.TopMargin = CentimetersToPoints(1.3)
.BottomMargin = CentimetersToPoints(1.3)
.LeftMargin = CentimetersToPoints(1.5)
.RightMargin = CentimetersToPoints(1.5)
End With
Selection.InsertFile FileName:="SSA Form.doc", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
End Sub
which SHOULD set margins from the PageBreak onwards but instead it is setting the margins for the whole document.
Can anyone point me in the right direction please?
As always any help is much appreciated
Seamus