Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    ChDrive and ChDir (Excel 97 and >)

    Hello All

    Its Monday and my brain still thinks its Saturday, so let me ask you, how does this work:

    If I have something like <font color=red> ChDrive "Gbpra_bdcChangeControlChangeRecord" </font color=red>

    Excel tells me Run-Time Error # 5 Invalid procedure call or argument

    But when I do a <font color=red> ChDir "Gbpra_bdcChangeControlChangeRecord" </font color=red> it works everytime even thought the drive designation is not the one for that path?

    Should I worry about changing the Drive letter when I don't have one?

    This will be accessed from multiple PCs so that is why I say I don't have the drive letter.

    TIA

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ChDrive and ChDir (Excel 97 and >)

    Hi Wassim,

    <<But when I do a ChDir "Gbpra_bdcChangeControlChangeRecord" it works everytime even thought the drive designation is not the one for that path?>>

    I guess the Chdrive does not work, because technically you are using a *path* (without a drive designation). If you map this path to a drive letter (one sort of creates a link to that path), then you can change drives.

    When there is no logon script that maps these paths to a default drive letter, you will be better off using the UNC paths in your code, those are equal to all users.

    It is very easy to assign the drive letter: just rightclick a folder in an UNC path and choose Map Network Drive.

    It is equally simple to detach it: Rightclick a mapped drive and choose Disconnect.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: ChDrive and ChDir (Excel 97 and >)

    Thanks Jan Karel

    I figured that out, and I now do use the UNC path to the server location. This is a requirement of the project so it was all well.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

Posting Permissions

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