![]() |
|
#1
|
|||
|
|||
|
I have no idea if this is possible, and I have tried a few solutions I have found through here and other websites. Nothing works so far.
I'm trying to create a form and want to use Mailmerge to help show certain data/documents I have received for something. I have a column in Excel that is a yes/no answer: IMMUNIZATIONS Yes No Yes No So the merge field would be IMMUNIZATIONS, and I want to have the "Yes" shown as a filled checkbox and "No" as an empty checkbox. So essentially it would be: (CHECKBOX) Immunizations Thank you |
|
#2
|
||||
|
||||
|
A mailmerge cannot update a checkbox. You can simulate one, however, using field coding such as:
{SYMBOL {IF{MERGEFIELD IMMUNIZATIONS}= "Y*" 254 168} \a \f Wingdings} Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
I know it cannot. I wanted it to create it. I've tried it using the same way you showed me and I just get ### when I do it.
I created the brackets using Ctrl + F9. |
|
#4
|
||||
|
||||
|
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 |
|
#5
|
||||
|
||||
|
Did you actually complete the merge, or are you just previewing it?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#6
|
|||
|
|||
|
I thought I was completing it bc I made it all the way to the complete merge part. But now I have it working. Thank you!
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
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 with Fields extracted from ROWS instead of COLUMNS or transpose of typical mail merge
|
djrexy | Mail Merge | 1 | 05-20-2020 04:04 PM |
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 |