• Repeat Completed Rows (Word 2003)

    Author
    Topic
    #436107

    Good Morning,

    I have a form that users can complete (example attached) and I would like to know if it is possible to have the first/second row “Cooking Sheet” and “Date” repeat at the top of the next page and the “Chef Information” rows repeat at the bottom of the next page. The row header repeat function repeats the entire 2nd row when all I need is the date. What happens now is when people type in their recipe and the field expands to the next page it only carries over the Chef information. I need that information to stay on the first page and also be carried over to the 2nd page. Any ideas? Is this even possible?

    Thank you,
    SME

    Viewing 3 reply threads
    Author
    Replies
    • #1032854

      Heading Rows, as the name implies, duplicate entire rows. Although a REF field can duplicate text from any form field or other bookmark, it’s not clear how you can use this without the duplicated information also appearing on the first page an extra time (e.g., in the top row). Perhaps there is a tricky way to do it by comparing the position of the REF field with the bookmark/form field, but that level of field wizardry is beyond my powers.

    • #1032871

      It’s not easy to repeat just part of a row. And although Word has a Heading Rows Repeat feature, it doesn’t have a counterpart for bottom rows. I’d put the information you want on every page in the page header and page footer. See post 259,183 for a demo – it employs a userform to set document variables, and the page header contains DOCVARIABLE fields that display the value of these variables.

    • #1032878

      With other similar requirements I have put ONLY the repeating information in the top row, and I have then created a text box, anchored outside the table, that covers part of the first row on the first page and includes the information that needs to be different.

      This won’t work for your solution since you can’t put those fields in a floating text box.

      StuartR

    • #1032884

      Thank you all for your great suggestions and insight! I will be testing out all of the suggestions throughout the week and will let you know how it goes. =). Again, Thank you!

      Warm Regards,
      SME

      • #1033142

        HansV. your reference to post 25913 was very helpful but I’m stuck. How can I change the “Subject” and “Info” text to read “Cook Name” and “Date” in the little box that pops up when I start word?

        Thank you,
        SME

        • #1033145

          Activate the Visual Basic Editor (Alt+F11).
          If you don’t see the Project Explorer (resembling the left hand pane of Windows Explorer), press Ctrl+R
          If you don’t see the Properties window or pane, press F4.
          Locate the template in the Project Explorer on the left.
          If necessary, expand it until you see frmSettings under Forms.
          Double click frmSettings.
          You’ll see the form in design view.
          Click on the word Subject.
          You’ll see in Properties that it is a Label.
          You can change the text it displays by editing its Caption property (see screenshot below).
          The label also shows an underlined letter, meaning that you can activate the corresponding text box by pressing Alt+that letter.
          When you change the caption, you’ll also want to change the underlined letter, by editng the Accelerator property.

          You can resize the form by clicking in an empty part of the form, then dragging one of the ‘handles’ in the bottom or right edge.
          You can use the Toolbox to add more controls such as text boxes and labels.

          • #1033362

            Thanks for your help. I’ve been working on my form all day and have figured out how to do most of the things you are referring to Hans. Your template in the other post, was very, very helpful. But, I’m stuck again. When I apply the Open Forms Macro used in your template it does not display the userform I created (I alos don’t have the settings option in the tools section). I’ve attached a copy of the VBA screen to show you the macro and my userform. Any help would be great!

            Thank you,
            SME

            • #1033367

              You have given the module and the macro it contains the same name (ShowForm). This is confusing to VBA. You should give the module another name, for example basShowForm.
              Does that help?

              To create a custom menu item, toolbar button and/or keyboard shortcut, you must select Tools | Customize in Word.
              For a menu item or toolbar button:
              – Activate the Commands tab.
              – Select your template in the ‘Save in’ dropdown (this is important!)
              – Select Macros in the list of Categories on the left.
              – Select ShowForm (with its prefixes) in the list of macros on the right.
              – Drag it to a convenient location on a toolbar or menu (menus will drop down if you hover the mouse pointer over them)
              For a keyboard shortcut:
              – Click the Keyboard… button.
              – Select your template in the ‘Save Changes in’ dropdown (this is important)
              – Select Macros in the list of Categories on the left.
              – Select ShowForm in the list of macros on the right.
              – Click in the ‘Press new shortcut key’ box.
              – Press the shortcut key combination you want to assign, for example Alt+Ctrl+G.
              – Click Assign.

            • #1033369

              Amazing! That did the trick. Thank you for your help. If I don’t get stuck again, Have a nice weekend cloud9

              Thank you,
              SME

            • #1033376

              You’re welcome!

            • #1033793

              Happy Monday! I’m stuck again. brickwall

              I set up the custom menu item that brings up my UserForm, but if I enter information into the UserForm it does not automatically update the fields, I have to manually update each field. While the custom menu item is very handy for my use, Is there a way I can get the UserForm to appear at the start of the form (as show in the example) as that may be a better option for mass distribution.

              This is the Code for my Userform:

              Option Explicit

              Private Sub cmdCancel_Click()
              Unload Me
              End Sub

              Private Sub cmdOK_Click()
              ‘ Prevent variable from being deleted
              If txtDate = “” Then txtDate = ” ”
              ActiveDocument.Variables(“Date”) = txtDate
              If txtCookName = “” Then txtCookName = ” ”
              ActiveDocument.Variables(“Cook Name”) = txtCookName
              If txtRecipeNumber = “” Then txtRecipeNumber = ” ”
              ActiveDocument.Variables(“Recipe Number”) = txtRecipeNumber
              ‘ Update fields in document
              ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Update
              Unload Me
              End Sub

              Private Sub txtRecipeNumber_Click()

              End Sub

              Private Sub txtCookName_Click()

              End Sub

              Private Sub txtDate_Click()

              End Sub

              Private Sub basShowform_Initialize()
              ‘ Load variables into text boxes
              On Error Resume Next
              txtDate = ActiveDocument.Variables(“Date”)
              txtClientName = ActiveDocument.Variables(“Cook Name”)
              txtClientIDNumber = ActiveDocument.Variables(“Recipe Number”)
              End Sub

              Private Sub UserForm_Click()

              End Sub

              SME

            • #1033804

              Look at the ThisDocument module in my example to see how the userform is displayed when you create a new document based on the template:

              Private Sub Document_New()
              ShowForm
              End Sub

              (ShowForm is a macro in the basMacros module)

              If you also want the userform to be displayed each time the user opens a document based on the template, add the following code to the ThisDocument module:

              Private Sub Document_Open()
              ShowForm
              End Sub

              In the example, the fields are in the page header. They are updated by the line

              ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Update

              If you placed the fields in the body of the document, you can use

              ActiveDocument.Fields.Update

              instead.

            • #1037065

              Good Afternoon,

              I’m stuck again on the issue of having the UserForm pop up when the document is first opened. I was able to add all the fields and I can manually show the form. I compared my form to the tester form in this thread and I just can’t figure it out. Any help would be really, really great! time I’m on a time crunch (end of the day today). I even bought a “Mastering VBA” book to no avail.

              Thank you,
              SME

            • #1037085

              Did you try the Document_Open() suggestion above? It should run immediately after a document is opened. This assumes that macro security is Medium or lower. If it’s High, then probably nothing will happen.

            • #1037087

              Thank you for replying.

              Yes, I have tried the above mentioned code and my Macro Security Settings are set to medium. If I open HansV’s example the window pops up…I just can’t get mine to do it. disappointed
              I even got a book on VBA (So I wouldn’t post the “simple” questions) but I’m still getting stuck. I thought the VBA book would help me through some of the little stuff but it looks like Woody’s Lounge is still the best place for answers.

              SME

            • #1037181

              blush Okay, I know what I did wrong: I was adding the code to the wrong area. Instead of adding the code to “This Document”, I was creating a new module and adding it there. I didn’t know you could add things to “This Document”. Boy, do I feel silly.

              Thanks for all of your help.

              SME

    Viewing 3 reply threads
    Reply To: Repeat Completed Rows (Word 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: