+ Reply to Thread
Results 1 to 7 of 7

open spreadsheet

  1. #1
    Registered User
    Join Date
    07-28-2005
    Posts
    73

    open spreadsheet

    what is the command to say to open a excel spreadsheet in vba?
    is there a way to open the spreadsheet without specifying the path , but the file to be opened will be in the same directory only .

    the problem is the file which has the macro will be copied to other folders so, i can;t specify the whole path .

    Thanks

  2. #2
    Registered User
    Join Date
    06-14-2004
    Posts
    52
    Sorry, tried to delete the post but to set the same folder use the Dir("") command This works, assumes same folder

    [CODE]
    Dir ("")
    Workbooks.Open Filename:= _
    "xxxxfilename.xls"
    [CODE]
    Last edited by whisperinghill; 02-02-2007 at 10:23 AM.

  3. #3
    Registered User
    Join Date
    07-28-2005
    Posts
    73
    it does not find the workbook... it says file cannot be found.

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    It should find it if you use the full path.

  5. #5
    Registered User
    Join Date
    06-14-2004
    Posts
    52
    Quote Originally Posted by jasoncw
    It should find it if you use the full path.
    Jason, he doesn't want to set a path, that was his problem, I found the Dir("") command in the help file.

    Worked for me, other wise if you don't set a path, then whatever your PC's default folder is, is where it looks, for most its the "My Documents" folder

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    OOPS! I didn't read the original thread, just the replies. Sorry for that.

  7. #7
    Registered User
    Join Date
    06-14-2004
    Posts
    52

    Smile

    I made a mistake on my first reply and then edited and for some reason didn't get saved

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1