Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 01-27-2022, 01:06 AM
gmayor's Avatar
gmayor gmayor is offline Mail Merge into Checkbox Windows 10 Mail Merge into Checkbox Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If you were to use E-Mail Merge Add-in or Merge and Split to merge your document to separate documents and the field was inserted in the merge document as

{ MERGEFIELD IMMUNIZATIONS } Immunizations
then you could run a macro on the fly to replace the value with a check box content control, either checked or not according to the value. e.g.
Code:
Sub FixCheck(oDoc)
Dim oChk As Range
Dim oWord As Range
Dim oCtrl As ContentControl
Dim bVal As Boolean

    Set oChk = oDoc.Range
    With oChk.Find
        Do While .Execute(findText:="Immunizations")
            Set oWord = oChk.Previous.Words.Last
            Select Case LCase(Trim(oWord.Text))
                Case "yes": bVal = True
                Case "no": bVal = False
            End Select
            Set oChk = oWord
            Set oCtrl = oChk.ContentControls.Add
            oCtrl.Range.Text = ""
            With oCtrl
                .Type = wdContentControlCheckBox
                .Title = "Immunizations": .Tag = .Title
                .Checked = bVal
                .LockContentControl = True
            End With
            Exit Do
        Loop
    End With
lbl_Exit:
    Set oChk = Nothing
    Set oWord = Nothing
    Set oCtrl = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge into Checkbox Mail Merge - Create seperate Mail merge pdf for each sheets of an excel file sureshbvs Word VBA 1 03-12-2021 05:42 AM
Mail Merge into Checkbox Mail Merge with Fields extracted from ROWS instead of COLUMNS or transpose of typical mail merge djrexy Mail Merge 1 05-20-2020 04:04 PM
Mail Merge into Checkbox IF Statements NOT working when the Merge Field is a checkbox shawn.low@cox.net Mail Merge 3 09-25-2019 04:05 PM
simple checkbox in e-mail as a signature angie0923 Word 0 11-03-2016 12:26 PM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:59 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