#1
|
|||
|
|||
UserForm to Add XML Mapped Content Controls
Hey Everybody - I'm hoping that someone here can tell me what I'm doing wrong. I'm a complete newb with XML, and I'm having a hard time with a UserForm.
Thanks in advance for taking a look!!! I'm working on a UserForm that does a few things
I have a macro that does this for specific things, Client and Vendor. So that info, and the XML paths are in the code. But I want to take input from the User form to create the XML path. I can get everything but that last bullet to work. This is the code I have so far: Code:
Option Explicit Dim strField As String Dim strPlace As String Dim strXML As String Dim strType As String Private Sub UserForm_Initialize() txtPlace.Value = "<< >>" txtXML.Value = "/root/" With cmbType .AddItem "Plain Text" .AddItem "Drop-Down" End With End Sub Private Sub cmdOK_Click() XMLField.Hide 'define strType If cmbType.Value = "Plain Text" _ Then strType = "Plain" If cmbType.Value = "Drop-Down" _ Then strType = "List" 'define other strings strField = txtField.Value strPlace = txtPlace.Value strXML = txtXML.Value 'add content control With Selection.Range If strType = "Plain" _ Then .ContentControls.Add (wdContentControlText) If strType = "List" _ Then .ContentControls.Add (wdContentControlDropdownList) End With Selection.ParentContentControl.Title = strField Selection.ParentContentControl.Tag = strField Selection.ParentContentControl.XMLMapping.SetMapping xPath:=strXML Selection.ParentContentControl.SetPlaceholderText Text:=strPlace End Sub |
Tags |
content control, userform, xml |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA to set Content controls as non printing | Sammie0Sue | Word VBA | 21 | 01-12-2021 04:44 PM |
VBA for content controls | ciresuark | Word VBA | 1 | 03-10-2015 03:14 PM |
Calculate Age From Content Controls | kintap | Word VBA | 10 | 07-02-2014 09:25 AM |
Content Controls | Sammie0Sue | Word | 6 | 11-06-2013 10:56 PM |
Grouping Content Controls | cksm4 | Word VBA | 2 | 03-01-2011 12:46 PM |