|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to go from static external data source in a Docvariable to userform input of dynamic text & date
Graham Mayor’s website includes an example and demonstration of how to create a userform which is located on his Word Pages Tab. The final example covers a userform containing a pair of multi-column list boxes. His illustration attached.
The data to populate the listboxes is taken from an external word document containing two tables. The second table has as its columns the name of the document which is displayed in the list box and the second column contains “content of letter1”, “content of letter2”, etc. When the selection is made from the first column “DocName1” the corresponding “content of letter1” is imported into a Docvariable Field contained in the document. This works perfectly for the contents of letters that are static and never change. I am considering an attempt to modify the demonstration to accommodate situations where the letters content can be modified. The various letters content would need from one to about six fields of data some with dates and some with text. My question is how best to modify with the minimum change to the structure of the demonstration to allow user input by way of textbox entry on the userform? Is it practical to include in a module the code necessary to find and place bookmarks in the “letter1” text, or whichever letter was selected after it has been imported into the Docvariable, where the dynamic data should be inserted with a corresponding series of textboxes conditioned upon which selection is made to display on the userform for entry of the data for insertion for each bookmark? Does anyone have thoughts on whether there is a better and simplier or more direct way to accomplish the desired result? |
#2
|
||||
|
||||
The example from my web site is very old and demonstrates a way to populate a userform from an external table. Personally I would now use content controls (which were not available when I created that particular example) to populate the document. The code to populate content controls is listed on that same web page.
If you want you can use text boxes for user input and write the values to the content controls and similarly you can read the contents from the controls back into the user form for editing. My friend Greg Maxey has several examples for userform creation on his web site that should help you get the results you require. Microsoft Word Help, Tips and Tutorials @ The Anchorage
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Save as Text to External Data Source Directory | Baiano42 | Excel Programming | 2 | 06-29-2019 09:42 PM |
Userform with Multiple Cascading Drop Down Lists Populated with External Source Data | venganewt | Word VBA | 21 | 05-16-2018 02:05 PM |
Excel data linked to external source | Doug Needham | Excel Programming | 1 | 09-15-2015 05:14 AM |
vba change external data source | excelledsoftware | Excel Programming | 1 | 07-17-2012 04:22 AM |
Refresh of data from external source | Jirik61 | Excel Programming | 3 | 07-13-2012 01:40 PM |