Attachment 24238
Can I use Excel VBA with data, to create a Winword form(Consists to control Checkbox)
How to use Excel VBA code to control Checkbox ( True / False ) in Winword ?
Printable View
Attachment 24238
Can I use Excel VBA with data, to create a Winword form(Consists to control Checkbox)
How to use Excel VBA code to control Checkbox ( True / False ) in Winword ?
The following should get you started
Code:Sub WriteToWord()
Dim wdApp As Object
Dim wdDoc As Object
Dim bCheck As Boolean
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err Then
Set wdApp = CreateObject("Word.Application")
End If
Set wdDoc = wdApp.Documents.Add(Template:="C:\Path\DocName.docx")
If Range("B2") = "Test" Then
bCheck = True
Else
bCheck = False
End If
wdDoc.SelectContentControlsByTitle("Title of Checkbox").Item(1).Checked = bCheck
End Sub