Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Nov 2004
    Location
    Sacramento, California, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB Code not changing directory (Excel 2003)

    I have the following code:
    ChDir "C:dds_txt"
    Workbooks.Open "Email List.xls", , N, , , , Y

    When I am located any where on the network, this seems to work - except when I am logged into my personal drive (H:/). In this case, the change doesn't work and I get the error "Email List.xls Not Found". Is there something I should add to the "CHDIR" command so it works from other drives?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VB Code not changing directory (Excel 2003)

    You can use

    Workbooks.Open "C:dds_txtEmail List.xls"

    Or use

    ChDrive "C:"
    ChDir "C:dds_txt"
    Workbooks.Open "Email List.xls"

  3. #3
    New Lounger
    Join Date
    Nov 2004
    Location
    Sacramento, California, USA
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB Code not changing directory (Excel 2003)

    Many thanks. So you know, I got an email from someone that said, "I have decided that Hans is not just one person." I don't know if you are (I can easily believe that there must be more than 1 of you), but whoever you are, I am always grateful. Thanks.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VB Code not changing directory (Excel 2003)

    There's just one of me...

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: VB Code not changing directory (Excel 2003)

    The username is a dead giveaway - HansI, HansII, HansIII and HansIV all do the research behind the scenes! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    New Lounger
    Join Date
    May 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB Code not changing directory (Excel 2003)

    Now, now...

    HansVI <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: VB Code not changing directory (Excel 2003)

    <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15> Nice!
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    3 Star Lounger
    Join Date
    May 2002
    Location
    Mpls, Minnesota, USA
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB Code not changing directory (Excel 2003)

    Good one Hans
    Chuck Reimer
    I'm from the Government and I'm here to help...

Posting Permissions

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