Results 1 to 3 of 3

Thread: vb(very basic) question

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    1

    Exclamation

    Being new to vb (actually vba) I've have come across the following brickwall:

    I'm writing code in xl which is activated when the file with the code is opened. Problem is this:

    I'm trying to open another XL file (which has links to and from the file with the code), update the links to that file and close and save changes. This in turn, updates the links in the file with the code. Both files are extremely sizeable and, for a variety of reasons, must remain separate.

    Works fine except when another user on the network is in the file that is being opened by the code. If there is another user in the file I am happy for the links not to be updated and for the file to simply be closed.

    Is there code which will tell you whether the file is in use and "locked for editing", which you can use in, say, an IF statement, to circumvent errors?

    Any assistance you gurus out there can give me will be appreciated. Just want to say that this site is GREAT!
    Matt

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    I suspect there may be an API call for this, but you could always attempt a simple update and then handle the exception if the file is locked.

    Just an idea.

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3
    Addicted Member aturner's Avatar
    Join Date
    Nov 2000
    Posts
    179

    i came accross a similar problem with vb5

    can you open the file without it erroring?
    Due to the energy crisis, the light at the end of the tunnel has been turned off.
    Sorry for any inconvenience this may cause

Posting Permissions

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



Click Here to Expand Forum to Full Width