Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2011, 12:22 PM
DKerne DKerne is offline Word Macro That Checks a Check Box Form Field When File Print is Executed Windows XP Word Macro That Checks a Check Box Form Field When File Print is Executed Office 2007
Novice
Word Macro That Checks a Check Box Form Field When File Print is Executed
 
Join Date: May 2011
Posts: 2
DKerne is on a distinguished road
Default Word Macro That Checks a Check Box Form Field When File Print is Executed

Title (mostly) says it all, folks. I've tried and (repeatedly) failed to reverse-engineer a template that used to contain commands that performed two distinct actions upon file print (related screen shot is attached):

  1. Change the value of one Check Box Form Field (let's call it CB-FF #1) from its default setting of "unchecked" to "checked"
  2. Change the value of a second Check Box Form Field (let's call it CB-FF #2) from its default setting of "checked" to "unchecked"
CB-FF #1 has an associated bookmark called "Controlled", and CB-FF #2 has an associated bookmark called "Uncontrolled" (yep, I need to change the doc status upon print for doc control purposes).



I imagine there's a simple solution, but damned if I can't figure it out. Thanks in advance for your assistance.
Attached Images
File Type: jpg CB-FF.jpg (36.5 KB, 20 views)
Reply With Quote
  #2  
Old 05-18-2011, 06:26 PM
macropod's Avatar
macropod macropod is online now Word Macro That Checks a Check Box Form Field When File Print is Executed Windows 7 32bit Word Macro That Checks a Check Box Form Field When File Print is Executed Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Why are you unable to use the previous userform (that's what you've posted an image of, not a document template)? What part of the project are you having trouble with? Creating the whole userform & code, checking the checkbox status, or updating the checkbox status?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-19-2011, 07:40 AM
DKerne DKerne is offline Word Macro That Checks a Check Box Form Field When File Print is Executed Windows XP Word Macro That Checks a Check Box Form Field When File Print is Executed Office 2007
Novice
Word Macro That Checks a Check Box Form Field When File Print is Executed
 
Join Date: May 2011
Posts: 2
DKerne is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Why are you unable to use the previous userform (that's what you've posted an image of, not a document template)? What part of the project are you having trouble with? Creating the whole userform & code, checking the checkbox status, or updating the checkbox status?
Hey, thanks for the reply. I'll try to answer your questions best I can.

I'm not hung up on using the existing userform, etc., I really just need something, anything, that allows me to uncheck a checked box and check an unchecked box whenever the document is sent to print.

I'm a total novice when it comes to coding/macros/VBA, and the person who initially created this document is long, long gone.

Any help you or anyone else can provide is much appreciated. Thanks again!
Reply With Quote
  #4  
Old 05-19-2011, 06:14 PM
macropod's Avatar
macropod macropod is online now Word Macro That Checks a Check Box Form Field When File Print is Executed Windows 7 32bit Word Macro That Checks a Check Box Form Field When File Print is Executed Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

OK, so you have an existing userform, about which you previously said it "used to contain commands that performed two distinct actions". Has it stopped working? have you tried re-installing whatever application/add-in it's part of?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-09-2011, 11:54 AM
Welshgasman Welshgasman is offline Word Macro That Checks a Check Box Form Field When File Print is Executed Windows 7 32bit Word Macro That Checks a Check Box Form Field When File Print is Executed Office 2003
Novice
 
Join Date: Jun 2011
Posts: 25
Welshgasman is on a distinguished road
Default Does this help

I am a novice at VBA and I was looking to do something smiliar and found this method.

I wanted a dropdown to set the relevant checkbox. Initially I read that you cannot set checkbox values, but eventually found that you can and how from here from which I created the following code

Hope it helps.?

Code:
Function SetChkType()
Dim strType As String
Dim oFFld As FormFields
strType = ActiveDocument.FormFields("lstType").Result
Set oFFld = ActiveDocument.FormFields

' Initialise checkboxes to empty (False)

    oFFld("chkAnswer").CheckBox.Value = False
    oFFld("chkPhone").CheckBox.Value = False
    oFFld("chkVisit").CheckBox.Value = False
    oFFld("chkLetter").CheckBox.Value = False
    oFFld("chkRefer").CheckBox.Value = False
    oFFld("chkEmail").CheckBox.Value = False

' Now set the correct one to True

Select Case strType
    Case "A"
        oFFld("chkAnswer").CheckBox.Value = True
    Case "T"
        oFFld("chkPhone").CheckBox.Value = True
    Case "P"
        oFFld("chkVisit").CheckBox.Value = True
    Case "L"
        oFFld("chkLetter").CheckBox.Value = True
    Case "R"
        oFFld("chkRefer").CheckBox.Value = True
    Case "E"
        oFFld("chkEmail").CheckBox.Value = True
End Select
End Function
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Macro That Checks a Check Box Form Field When File Print is Executed Word Macro: Save file as text with current file name jabberwocky12 Word VBA 2 10-22-2010 12:23 PM
Print Macro in MS Word steve207 Word VBA 0 09-10-2010 02:11 AM
Word Macro That Checks a Check Box Form Field When File Print is Executed Custom Form Check Box's shogan Word 1 05-14-2010 09:00 PM
How to Cross reference a check box in a form janene_vaughn Word 0 12-29-2009 12:34 PM
Converting a check box form into text tmcii82 Word VBA 0 11-20-2009 08:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft