![ms word combo box additem ms word combo box additem](https://i.ytimg.com/vi/KjCbCJriIII/maxresdefault.jpg)
SetBMRangeValues "bkmColor", "User did not respond" StrEdu = Left(strEdu, InStrRev(strEdu, ",") - 1) & " and" & Mid(strEdu, InStrRev(strEdu, ",") + 1) If Len(strEdu) > 2 Then strEdu = Right(strEdu, Len(strEdu) - 2) chkRS Then strEdu = strEdu + "_Reform School"
![ms word combo box additem ms word combo box additem](https://cdn.extendoffice.com/images/stories/doc-word/word-insert-drop-down-list/doc-word-insert-drop-down-list-4.png)
chkMasters Then strEdu = strEdu + "_Masters" chkBach Then strEdu = strEdu + "_Bachelors" chkHS Then strEdu = strEdu + "_High School" 'Build a string based on checkboxes that are checked Sub PopulateDocumentII(ByRef oUF As UserForm) For example change the table cell data in the document example and then redisplay the userform. With several of the methods shown data can be updated or modified in the document and those changes can be reflected in the userform. MsgBox "An error occurred while retrieving data from your document." _ GetBMRangeValue = ActiveDocument.Bookmarks(pBMName).Range.Text & vbCr & "The bookmark " & Chr(34) + pBMName + Chr(34) & " does not exist.", _įunction GetBMRangeValue(pBMName As String) As String MsgBox "An error occurred while processing your document." _ Set oRng = ActiveDocument.Bookmarks(pBMName).RangeĪ pBMName, oRng Sub SetBMRangeValues(ByRef pBMName As String, pText As String)
![ms word combo box additem ms word combo box additem](https://tarsolutions.co.uk/wp-content/uploads/2012/04/VBA-References-activex-data-objects-library.png)
When you make your document design decisions you might consider checking for their presence as well. Of course some of the other placeholders could also be deleted. Accordingly, I recommend using a pair of separate procedures that checks and verifies the presence of the bookmarks before attempting to read from or write to their respective ranges. Especially if they are not displayed in your documents. They can also be easily deleted or overwritten. Note: Bookmarks seem to be the document placeholder method of choice for many. txtFFDemo2.Text = ActiveDocument.FormFields("ffDemo2").Result txtFFDemo1.Text = ActiveDocument.FormFields("ffDemo1").Result
![ms word combo box additem ms word combo box additem](https://wordknowhow.files.wordpress.com/2013/06/untitled10.jpg)
txtCCDemo2.Text = ActiveDocument.SelectContentControlsByTitle("ccDemo2").Item(1).Range.Text txtCCDemo1.Text = ActiveDocument.SelectContentControlsByTitle("ccDemo1").Item(1).Range.Text Len(ActiveDocument.Tables(1).Cell(1, 2).Range.Text) - 2) txtCellDemo2.Text = Left(ActiveDocument.Tables(1).Cell(1, 2).Range.Text, _ Len(ActiveDocument.Tables(1).Cell(1, 1).Range.Text) - 2) txtCellDemo1.Text = Left(ActiveDocument.Tables(1).Cell(1, 1).Range.Text, _ txtBkmDemo2.Text = GetBMRangeValue("bkmDemo2") txtBkmDemo1.Text = GetBMRangeValue("bkmDemo1") 'Call Function to get the bookmarked data. txtVarDemo2.Text = ActiveDocument.Variables("varDemo2").Value txtVarDemo1.Text = ActiveDocument.Variables("varDemo1").Value This can be accomplished using the UserForm_Initialize event as follows:
#MS WORD COMBO BOX ADDITEM UPDATE#
When a user needs to display the userform again in the current document to update or modify data, he or she will most likely want the existing data in the document to be visible in the form.
#MS WORD COMBO BOX ADDITEM CODE#
'Call (full code is available in the template) 'update fields to show current docvariable values SelectContentControlsByTitle("ccDemo2").Item(1).Range.Text = SelectContentControlsByTitle("ccDemo1").Item(1).Range.Text = 'Call procedure to set the bookmark range values If oDoc.ProtectionType wdNoProtection Then ActiveDocument.Unprotect Sub PopulateDocument(ByRef oUF As UserForm)