![]() |
#1
|
|||
|
|||
![]()
I have a MS Word (Office 2016) form (attached) that uses different types of Custom Controls.
I want to extract the values and add them to an existing file, which is used as a data source for various excel spreadsheets. The existing file is located at: \\mynetworklocation\mysubfolder\sourcefile.csv I've spent hours searching for a solution, but none seem to work. I tried exporting as a csv to a new file (with the intent of later concatenating it to the other), but the export ignores the checkbox status (true/false, checked/unchecked). I'm at a loss. |
#2
|
||||
|
||||
![]()
The following will extract the data to an worksheet including the values from the checkboxes. Extract data from forms You can save the worksheet as CSV.
The basic code to get the value from a checkbox content control is Code:
Sub Macro1() Dim oCC As ContentControl Dim objCC As Object Dim strData As String Set oCC = ActiveDocument.SelectContentControlsByTitle("SportsCheckbox").Item(1) If oCC.Type = wdContentControlCheckBox And Val(Application.Version) > 12 Then Set objCC = oCC If objCC.Checked Then strData = True Else strData = False End If MsgBox strData Else MsgBox "Not a checkbox" End If End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
![]() |
Tags |
export, word form |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
append multiple time values to date in one column | sarahafeez | Excel | 1 | 09-25-2017 11:01 PM |
![]() |
erik816 | Word VBA | 1 | 03-09-2016 12:48 AM |
Custom form - tab to **after** existing text in field | luketemp | Outlook | 0 | 03-04-2016 09:11 AM |
![]() |
charlesdh | Word VBA | 12 | 07-30-2015 08:21 PM |
![]() |
aarun2 | Word VBA | 1 | 04-08-2014 03:20 PM |