PDA

View Full Version : open worksheet



rayoconnell
05-11-2007, 01:52 AM
Hello all,

New to this site, so here is my problem.
I have populated a listbox on a form, from a folder on my desktop. the folder contains .xls files.
I am then trying to open a selected file from that list box.
here is what i have done so far,
dim pathaname
dim run
pathname=("excel.exe" & txtfilename.text & listbox1.value)
'txtfilename.text is where the user types in the address of the folder that wil populate the listbox.
run = shell (pathname, [vbnormalfocus]
when i run this it tells me file not found. although the address is correct in the pathname but when i hover the curser over run it states run=empty.
please help. i have been at this way too long.:banghead:

Charlize
05-11-2007, 02:55 AM
If the workbooks are all in the same place as the folder on your desktop ...Workbooks.Open (ActiveWorkbook.Path & "\" & Me.Listbox1.Value)Charlize

rayoconnell
05-11-2007, 03:08 AM
thanks
you are a legend,
if you were here id kiss ya.