Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open File for Input (Excel XP)

    I've written come code to create a batchnumber file. My problem is that I want 3 pc's to work from the same file. What I have done is to share the directory on the "master" pc and then map it on the other 2 pc to the Z: drive.

    My problem is the following code recognize the ChDir but give a error can't find the file. Please help.

    ChDir "Z:BatchRegister"
    Open "BatchNoFile" For Input As #1
    Input #1, BatchNo
    Close #1
    BatchNo = BatchNo + 1

    Thanks

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

    Re: Open File for Input (Excel XP)

    You might try preceding this code with a drive change:

    Chdrive "Z"

    Also, I see your filename does not contain an extension. Is that deliberate?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open File for Input (Excel XP)

    I didn't know about the Chdrive "Z" command. Is it differant to the chDir command.

    The file extension I will put in - Thanks

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

    Re: Open File for Input (Excel XP)

    chdir normally only works within the current drive so needs to be preceded by chdrive.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open File for Input (Excel XP)

    Makes sense

    Thanks

  6. #6
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open File for Input (Excel XP)

    Thanks for the help. Tried it and it works great

    Thanks again

Posting Permissions

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