Add a new page in a form by using a macro???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which is currently one page long. I have put the form fields
in tables and limited the number of characters in the form fields so that the
formatting of the form will not be changed when too much text is entered.

However, a user may at times need to enter more text than the field allows.
Is there a ??macro?? that can be invoked when the field is "full" that will
insert a new page with an unlimited form field?
 
La La Lara was telling us:
La La Lara nous racontait que :
I have a form which is currently one page long. I have put the form
fields in tables and limited the number of characters in the form
fields so that the formatting of the form will not be changed when
too much text is entered.

However, a user may at times need to enter more text than the field
allows. Is there a ??macro?? that can be invoked when the field is
"full" that will insert a new page with an unlimited form field?

I don't thnik you can do that easilyt in an automatic manner. However, it is
fairly ewasy this way:

Add a MACROBUTTON field under the field that could continue on the next
page:
{MACROBUTTON AddPage Double-click here to add a page}
(Do CTRL-F9 to add the curly braces {}, then type the text in between as
shown here.
Select the field and do SHIFT-F9 to hide the code and display the message.

Protect the foirm.

Add the following macro in a standard module:
'_______________________________________
Sub AddPage()

Dim MyRange As Range

Set MyRange = ActiveDocument.Range

ActiveDocument.Unprotect "MyPassword"

With MyRange
.Collapse wdCollapseEnd
.InsertBreak wdPageBreak
.Collapse wdCollapseEnd
.FormFields.Add Range:=MyRange, Type:= _
wdFieldFormTextInput
.Select
End With

ActiveDocument.Protect wdAllowOnlyFormFields, _
True, "MyPassword"

End Sub
'_______________________________________

That's it!

If your form is not protected by a password, change


ActiveDocument.Unprotect "MyPassword"
and
ActiveDocument.Protect wdAllowOnlyFormFields, _
True, "MyPassword"
to
ActiveDocument.Unprotect
and
ActiveDocument.Protect wdAllowOnlyFormFields, _
True
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
Back
Top