Avatar of DarrenJackson
DarrenJackson
Flag for United Kingdom of Great Britain and Northern Ireland asked on

run excel vb script based on combobox

Guys,

I need some help. I have attached an excel sheet which has a combobox in sheet "MAIN" what I want it to do is look at a specific folder and list all the subfolders so that I can choose. Then when you press the IMPORT button I want the vb code behind the IMPORT button to use what I have chosen in the combobox to execute the script.

Can anyone help
Book1.xlsm
Microsoft ExcelVB Script

Avatar of undefined
Last Comment
DarrenJackson

8/22/2022 - Mon
kyodai

Do it like this...

if Combo1.ListIndex = 0 then
'execute first script
RunScriptOne
elseif Combo1.ListIndex = 1 then
'execute second script
RunScriptTwo
...
DarrenJackson

ASKER
HI kyodai thanks for helping.

The example you have given wont give me the ability for my combobox to look up folders within a subfolder.

I think you have misread my question
SOLUTION
kyodai

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
DarrenJackson

ASKER
Where would I place this within my attached excel file so that when I press on the drop down box within my combobox I get the folders within C:\  ?

Regards
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Rory Archibald

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
DarrenJackson

ASKER
Rory this is perfect.

Thankyou for this.