View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA for opening file/populating combo box with sheet names

1. Take a look at the GetOpenFileName method, as it allows the user to
select the file. It doesn't open it, just returns the full path which you
can save in a variable.

2. Save the sheet names in a hidden worksheet, and link your combobox to
that range.

Forms controls are maybe easier to use, but control toolbox controls are
more flexible.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Sinobato " wrote in message
...
Hello again Excel VBA gurus!

I am almost halfway now on my Excel application I'm doing and would
just like to ask for some help on what I'm supposed to happen once I
run my scripts:

1. When the user click a command button, I would like to inquire what
file he would like to open and put that filename on a variable, like
when you do a File - Open.
2. Once the file is opened, I would like to populate a combo box or a
drop-down list with the names of the sheets on the workbook and place
on another variable the sheet that the user had chosen so that I can
use it to determine which sheet will I want my main script to work on.

Last question, on Excel, what is the difference when you use objects on
the Forms toolbox as compared with using the control toolbox?

Thanks as always for your help!
Sinobato


---
Message posted from http://www.ExcelForum.com/