Last Section incorrect when creating new doc. from protected form

A

alisam

My template document has 22 sections.
1-4 is a Protected Form
5 is unprotected
6-9 is a Protected Form
10 protected
11-16 protected and has bookmarks to fields in the Protected Form
17-21 protected and has bookmarks to fields in the Protected Form
22 protected

As far as I can tell. All the sections have the same Page Setup settings.

I start a new document based upon the template and fill in the form. A macro
uprotects the form, selects sections to 11-16 and creates a new document and
keeps the new document on the screen. This is working as expected.

The new document has 6 sections to it and are separated by a 'Section Break
(Continous)' EXCEPT for the very last section. This has a 'Section Break
(Next Page)', which of course causes a new page to be generated and the
Margins have used a default from somewhere.

I believe section 6 is somehow picking up the Page Setup settings from the
normal.dot template. However, the contents of the header are correct.

Any ideas on how to get section 6 to have exactly the same Page Setup as
sections 1 to 5.
 
A

alisam

I just realised that my new document would have been created based upon
normal.dot. Here is the macro I am using (and given to me by a kind person in
the forum). How and where do I add a command to create a new document based
upon (say) xyz.dot?

Is this the best way of solving my issue?

Sub Release_Client()
'
' Release_Client Macro
' Macro will select Sections 11 to 16 and save in the Client folder
'
Dim Source As Document, Target As Document
Dim fname As String
Dim arange As Range
Dim amsg As String

Set Source = ActiveDocument
With Source
fname = "anything"
Set arange = .Sections(11).Range
arange.End = .Sections(16).Range.End
MsgBox amsg
End With
Set Target = Documents.Add
With Target
.Range.FormattedText = arange.FormattedText
.Range.Fields.Unlink
Selection.EndKey Unit:=wdStory
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
.SaveAs fname
' .Close

End With

End Sub
 

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