Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Read from locked text-file (VB6 - VBS)

    I'm looking for a VB6 and VBS approach to read a value from a text-file that is locked by another process (when I try to copy and paste it in Explorer, it fails. However I CAN open the file in NotePad)

    Suggestions?

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

    Re: Read from locked text-file (VB6 - VBS)

    Have you tried using the old-fashioned Open, Line Input and Close instructions?

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read from locked text-file (VB6 - VBS)

    I'm using this:

    Dim Line as tring
    Open File For Input Shared As #1
    Input #1, Line
    Close #1

    EJ

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

    Re: Read from locked text-file (VB6 - VBS)

    If that fails (I assume you meant String instead of tring), I don't know how to do it.

  5. #5
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read from locked text-file (VB6 - VBS)

    Anybody else who knows how to do this?? Again: NOTEPAD works.

    EJ

  6. #6
    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: Read from locked text-file (VB6 - VBS)

    How does your code fail?
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read from locked text-file (VB6 - VBS)

    If I try to copy it manually, I get "Access Denied". If I open it in NotePad there is no problem. I can only run the VB6 EXE on that unit but will compile a debug version and will let you know later

  8. #8
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read from locked text-file (VB6 - VBS)

    It was me, I made a coding error - works now ... sorry <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20>

Posting Permissions

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