But you are not stating - in any way - how that page 2 is formatted or set up.
Does page 2 have formfields that need to filled in? If so, does that mean you want to make NEW formfields for the new page (if a new page is needed).
"But...it seems that when you set up forms that is all there is. In other words you can't just keep adding pages when necessary. "
No, you can not. That is the main
purpose of having and using forms.
Can it be done to able to add further pages? As I have stated, yes. I will reiterate. Tell us how - EXACTLY - what it is you want to do. I am not a mind reader, and I can not see your page 2. I do not know what is there, so I can not tell you how to do further pages that are formatted like page 2.
What criteria determines if new pages are needed? How do you want to tell Word to make new pages - a button? a shortcut key? If the last formfield on page 2 is a text formfield, and you kept on typing beyond the bottom margin boundary...than that would make a new page all by itself as the text formfield expanded to take the text input.
Is that what you are talking about? I am kidding. I doubt that very much.
Look, I am trying to help. But you need to give us some specific logic to work with.
Say your person has filled out page 1 and page 2, WHAT determines they need a page 3? Do they need the ability to add more than one page? Do you want them to be able to say..give me THREE new pages? Would all the new pages be identical? How do you want you want then to action this?
It could be fairly easily done, like this:
Oh, I need another page. Click a button on a toolbar (or a shortcut key if you prefer) - see below for an example of some code that does this. Another page is made.
OR....do you want to have it that when the user gets to the LAST formfield on page 2, that they get a question box asking if they need another page? That could be done as well.
But what - EXACTLY - does that mean? You state it is like page 2, but we do not know what page 2 is like. If it has formfields that need input, then that means different formfields (by name). This can be done, but it requires precise, exact, statement of requirements.
In any case, because the document is protected for forms, if you want to add anything, the
first thing needed is to turn off forms protection.
That moves this into a VBA question. For that reason, if you wish to go forward, I suggest posting to the VBA forum.
Just to give you a taste of what CAN be done - but we still need more details for your specific case:
I just made a document with three formfields on page 1, three formfields on page 2.
The following code is executed by clicking "New Page" on the top toolbar. It is easy to put a call to a procedure as a button (or in this case, text) on a toolbar.
Code:
Option Explicit
Sub MakeNewPage()
Dim r As Range
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
End If
Set r = ActiveDocument.Range
With r
.Collapse 0
.InsertBreak Type:=wdPageBreak
.Collapse 0
End With
With ActiveDocument
.AttachedTemplate.AutoTextEntries("TestTT").Insert _
Where:=r, RichText:=True
.Protect wdAllowOnlyFormFields, NoReset:=True, _
Password:=""
End With
End Sub
This is only one way to go about this. There are other ways, and which way you use
depends on what your EXACT requirements are.
In the code above I used an AutoText entry (essentially the content of my page 2, including formfields). That may not be the best route for you. I do not know, as I do not know what you have on page 2.
"A little piece of heaven
without that awkward dying part."
advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)
Gerry