'The Excel file defining the simple list. You should notice that the data (the simple list) is defined in an Excel workbook named "Excel Data Store.xlsx" The workbook path and and sheet name "Simple List" are passed as arguments to the function shown above.ĭim oCC As ContentControl, oFF As FormField ORS.Open "SELECT * FROM [" & strRange, oConn, 2, 1įcnExcelDataToArray = oRS.GetRows(lngRows)įor the "Simple List" example, the arguments passed to the function and resulting array returned are shown below. Set oRS = CreateObject("ADODB.Recordset") "Extended Properties=""Excel 12.0 Xml HDR=" & strHeaderYES_NO & """ " OConn.Open ConnectionString:="Provider=.12.0 " & _ Set oConn = CreateObject("ADODB.Connection") If bIsSheet Then strRange = strRange & "$]" Else strRange = strRange & "]" If Not bHeaderRow Then strHeaderYES_NO = "NO" 'Default parameters include "Sheet1" as the named sheet, range of the full named sheet _ Optional bHeaderRow As Boolean = True) As Variant Optional strRange As String = "Sheet1", _ Private Function fcnExcelDataToArray(strWorkbook As String, _ See: Populate Userform ListBox or ComboBox Simple Listįor a demonstration of importing a simple list, I will use data from an Excel Workbook sheet named "Simple List." Representative Excel data and data imported into an associated document content control is shown below: However, these are beyond the scope of this tips page. Useform lists and comboboxes are also available for use by a document developer. To make an ActiveX ComboBox function as a dropdown list, set the MatchRequired property = True and the Style property = frmStyleDropdownListģ. Since an ActiveX Listbox is not presented in a "Dropdown" format, it is mentioned for completeness only.Ģ. With Word, the document designer can employ one or more of several different "list" types which enable the document user to make a single (or in some cases multiple) selection. This tips page was inspired by a frequently viewed post in a popular Word support forum and addresses the question "How to import an Excel list into a Word dropdown list?" See: MSOffice Forums Link
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |