Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Turn off Grey Form Fields with macro/control butto (Word 2003)

    You'll see a small white outlined button in the upper corner underneath "Abst: "

    This is a button to remove the green and red control fields and TURN OFF GREY IN FIELDS, for a nice clean printer document.

    Could anybody please help me figure out how to add the code to turn the Form Field Backgrounds clear, instead of grey? (my office wants the grey for entering data)

    Thanks!
    Attached Files Attached Files

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Turn off Grey Form Fields with macro/control b

    I have Word 2007 in front of me this AM, so I'm not sure whether this is exactly the same in Word 2003. You can make the field shading appear only in the selected field, which removes all field shading for purposes of printing, using the following:

    <code>ActiveDocument.FormFields.Shaded = False</code>

    Resetting it to True restores shading to all of the fields. Does it work in 2003?

  3. #3
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Hmmmm... I added that code, but the field shading still doesn't change for me in Word 2003.
    Attached Files Attached Files

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

    Re: Turn off Grey Form Fields with macro/control b

    You added some code to the cleanup_Click procedure in NewMacros but that procedure is only executed if you run it explicitly. You haven't added the code to the cleanup_Click procedure in ThisDocument, that is the one executed by clicking the cleanup command button in the document.
    You could also create a Document_Open event procedure and/or a Document_New event procedure (both in ThisDocument) with the line

    ActiveDocument.FormFields.Shaded = False

  5. #5
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Great! I still don't understand why i can't put all my macros on one page, but at least it works. Thanks a bunch, guys!

    Here is my last problem...

    I need a drop-down menu (or something like it) which only hides bookmark: EffectiveDate1 and shows EffectiveDate2 if "Update Report" is chosen from the menu.

    Should I run a macro upon exiting the drop down menu, or try a different control?

    Thanks!
    Attached Files Attached Files

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

    Re: Turn off Grey Form Fields with macro/control b

    The On Click event procedure for a command button from the Control Toolbox *must* be in the ThisDocument module, otherwise it isn't recognized.

    You can create a combo box (dropdown list) from the Forms toolbar, and specify a macro to be run on exit of the combo box. This macro must be in a standard module, not in ThisDocument.

  7. #7
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Hans,

    I'm looking for a control "like" a drop down menu, but which will execute hiding and showing a couple of different bookmarks as soon as "Update Report" is selected. (instead of after the field is exited)
    Is this what a combo box does? I can't figure out how to add drop down items to it... hmmm...
    Attached Files Attached Files

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

    Re: Turn off Grey Form Fields with macro/control b

    To populate a combo box from the Control Toolbox, you must use VBA code in the Document_New and Document_Open event procedures in ThisDocument in the template. For example:

    Private Sub Document_New()
    Call FillCombo
    End Sub

    Private Sub Document_New()
    Call FillCombo
    End Sub

    Sub FillCombo()
    With Me.ComboBox1
    .AddItem "Twenty-one Year Judicial Search Report"
    .AddItem "Two Owner Search Report"
    .AddItem "Current Owner Report"
    .AddItem "Update Report"
    End With
    End Sub

    You can write code in the On Change or On Click event procedure for the combo box, also in ThisDocument in the template:

    Private Sub ComboBox1_Change()
    Select Case Me.ComboBox1
    Case "Twenty-one Year Judicial Search Report"
    ...
    Case "Two Owner Search Report"
    ...
    ...
    End Select
    End Sub

  9. #9
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    This one is driving me loony, Hans. I can't seem to get my small grey clean-up button (upper right corner) macro to follow the template into a new document. Also, there is something Buggy in my Combo Box Code. It won't see the bookmarks i defined to show/hide lines. please help!

    thanks,
    noah
    Attached Files Attached Files

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

    Re: Turn off Grey Form Fields with macro/control b

    1) The cleanup button works OK when I try it. It will execute the code stored in the template.

    2) Your use of With and End With is very inconsistent. See the attached version, I have simplified the ComboBox1_Change code.
    Attached Files Attached Files

  11. #11
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Hans, you are the man!

  12. #12
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Hans, are you aware how to make this combo box show the text "Select Report" instead of being invisible?
    Attached Files Attached Files

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

    Re: Turn off Grey Form Fields with macro/control b

    You could change the code for FillCombo as follows:

    Sub FillCombo()
    With Me.ComboBox1
    .AddItem "Please Select a Report"
    .AddItem "Twenty-one Year Judicial Search Report"
    .AddItem "Two Owner Search Report"
    .AddItem "Current Owner Search Report"
    .AddItem "Current Owner (Copy of Deed) Search Report"
    .AddItem "Update Search Report"
    .ListIndex = 0
    End With
    End Sub

    This adds a first item "Please Select a Report" and selects this item by setting the ListIndex property to 0 (items in a combo box are numbered starting at 0, so 0 is the first item).

  14. #14
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Fantastic! Thanks Hans.

  15. #15
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Grey Form Fields with macro/control b

    Is there a way to write a macro that takes the values of a text box, and populate another text box, so the user doesn't need to type the same info twice?

    thanks,
    Noah
    Attached Files Attached Files

Page 1 of 2 12 LastLast

Posting Permissions

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