View Single Post
 
Old 01-13-2015, 02:22 PM
ptmuldoon ptmuldoon is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Sep 2014
Posts: 93
ptmuldoon is on a distinguished road
Default Create UserForm ComboBox or ContentControl

I've been struggling with the best way for a user to be able to press a button/macro, etc then choose from a selection of charts to add to their document. I think I moved away from using building blocks to either a UserForm or Content Control.

In my Excel file, I have created a worksheet that has 2 columns. A Chart Name and the LINK code of the chart.

From Macropod, I found this post on creating a Content Control how-import-list-excel-into-drop-down But for some reason, when I when chose an Item, I am not getting the Value to show in the word document although I see a different value (ie, column B) when viewing the properties.

and then I also found this post by MVP Greg Maxey on setting up a Userform list from the excel data populate_userform_listbox_or_combobox. But again, I'm still struggling on getting the dropdown list to show a Chart Name/Description, and then input the link code.

I can post more sample code. But before doing so. Which would be the better approach to work with.

And to help, In word, I can currently open the excel file, get the link and add it with the below. Now I'm trying to create a listing of all of the charts/links

Code:
'    Code above to get Excel File and Chart.  Using late Binding so user
'    does not need to set reference in Word.
'
'    With objSht
'        ChartLink = .Range("C2")
'        MsgBox ChartLink
'    End With
'
'    C2 Cell Value is = LINK  Excel.SheetMacroEnabled.12 "C:\\Data\\SampleWPs.xlsm" "Cover Charts!Charts_Cover_Main" \p
'    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=ChartLink, PreserveFormatting:=False
Reply With Quote