Consulting

Results 1 to 3 of 3

Thread: open worksheet

  1. #1
    VBAX Regular
    Joined
    May 2007
    Location
    the peoples republic of cork
    Posts
    19
    Location

    open worksheet

    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.

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    If the workbooks are all in the same place as the folder on your desktop ...[VBA]Workbooks.Open (ActiveWorkbook.Path & "\" & Me.Listbox1.Value)[/VBA]Charlize

  3. #3
    VBAX Regular
    Joined
    May 2007
    Location
    the peoples republic of cork
    Posts
    19
    Location
    thanks
    you are a legend,
    if you were here id kiss ya.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •