View Full Version : Can I use Excel VBA with data, to create a WinWord form (Consists to control Checkbox
justuptou
05-19-2019, 07:33 PM
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 ?
gmayor
05-20-2019, 05:14 AM
The following should get you started
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
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.