Link to home
Start Free TrialLog in
Avatar of Jason
JasonFlag for Australia

asked on

VBA word userform combobox filled by 2 excel columns

I need help with VBA sample code in word.
I have a userform with 2 comboboxes
I need to connect to an excel file with 2 worksheets.
first combobox is populated by first column of the first worksheet.
second combobox need to be populated by the first and third column of the second worksheet.

Any help would be appreciated
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Why not simply just use Excel. You can set up a worksheet to represent the layout of your Word Doc

Here's an article that might help

Import Excel List into Word Dropdown Listuse Excel?
Avatar of Jason

ASKER

Hi Roy
I could do that but i prefer to work in word and connect to excel for tge data.  Any other suggestions???
Can you upload a sample word file and an excel file laid out like your real file for testing?
Avatar of Jason

ASKER

Here is some sample files

sample-ROE_Document.docm
sample-ROE_DB.xlsx

Thx
Jason
Avatar of Jason

ASKER

Note

one company could have multiple location.  That why I need to columns in the combobox.
ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jason

ASKER

Thx that works fine but I need to have the excel file open at the same time.  Can you help with the code where it achieves what you have done without having the excel file open.
Avatar of Jason

ASKER

Can any one help with fixing up the code for the above
Sorry, I am unable to help further on this. You can Click on the chat icon on the bottom right corner of this window to ask support for further assistance.
Avatar of Jason

ASKER

Thank you for your help :)