Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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: 26
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
 

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 12:55 AM.


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