Microsoft Office Forums Append values from a MS Word form to an existing CSV or text file

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2019, 01:12 PM
markiko markiko is offline Append values from a MS Word form to an existing CSV or text file Windows 10 Append values from a MS Word form to an existing CSV or text file Office 2016
Novice
Append values from a MS Word form to an existing CSV or text file
 
Join Date: Jul 2019
Posts: 1
markiko is on a distinguished road
Default Append values from a MS Word form to an existing CSV or text file

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.
Attached Files
File Type: docx Testform.docx (19.5 KB, 3 views)
Reply With Quote
  #2  
Old 07-11-2019, 09:58 PM
gmayor's Avatar
gmayor gmayor is online now Append values from a MS Word form to an existing CSV or text file Windows 10 Append values from a MS Word form to an existing CSV or text file Office 2016
Expert
 
Join Date: Aug 2014
Posts: 2,802
gmayor is just really nicegmayor is just really nicegmayor is just really nicegmayor is just really nice
Default

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
Reply With Quote
Reply

Tags
export, word form

Thread Tools
Display Modes


Similar Threads
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
Append values from a MS Word form to an existing CSV or text file How do I programmatically insert and append the text from AutoText 0002 to the end of the existing t 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
Append values from a MS Word form to an existing CSV or text file Append to Existing file charlesdh Word VBA 12 07-30-2015 08:21 PM
Append values from a MS Word form to an existing CSV or text file How to append specific *.tif image with another tif file through Word VBA aarun2 Word VBA 1 04-08-2014 03:20 PM


All times are GMT -7. The time now is 02:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft