Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jun 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto-Generate n Form Entries (2003)

    The attached form has a heading and a Table.

    I want to add a pop-up menu which comes when opening the file
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto-Generate n Form Entries (2003)

    You could store the table in the template as an AutoText entry and use code in the Document_New event to insert a number of copies of the AutoText entry in the document:

    Private Sub Document_New()
    Dim intNumber As Integer
    Dim i As Integer
    intNumber = Val(InputBox(Prompt:="How many students?", Default:=5))
    ActiveDocument.Unprotect
    For i = 1 To intNumber
    Selection.EndKey Unit:=wdStory
    ActiveDocument.AttachedTemplate.AutoTextEntries("S tudent").Insert _
    Where:=Selection.Range
    Selection.InsertParagraphAfter
    Next i
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields
    End Sub

    See attached version.
    Attached Files Attached Files

  3. #3
    Lounger
    Join Date
    Jun 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto-Generate n Form Entries (2003)

    Cheers Hans,

    Opened the file, but just got a blank document, cant see any buttons or pop-up box

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto-Generate n Form Entries (2003)

    Make sure macro security is not set to High in Tools | Macro | Security. Medium is the recommended setting. When you open the template, you'll get a warning; click Enable macros.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •