Results 1 to 8 of 8

Thread: Locked FIles

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Isle of Man
    Posts
    276

    Locked FIles

    I'm using the Word object's Open method to open a file, eg

    Code:
    Dim objWordApp as Word.Application
    Dim objWordDoc as Word.Document
    
         Set objWordApp = New Word.Application
         Set objWordDoc = objWordApp.Documents.Open <Path>
    This works fine, unless the file is opened by another user (or anothe rprocess) in which case the program hangs while waiting for a response to a message that the user can't see.

    Is there any way to check if the file is locked before opening it. Being able to find out the name of the workstation that has it locked would be even better.

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    maybe if u set the Visible parameter to true, it will show the msgbox...

    VB Code:
    1. Set objWordDoc = objWordApp.Documents.Open <Path>, , , , , , , , , , , True
    -= a peet post =-

  3. #3
    chenko
    Guest
    If you open it for read only it dont matter if another use has it open.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Isle of Man
    Posts
    276
    I was probably a bit brief in the description of my problem...

    The word application is opened in the background. Values are inserted into fields in the document and the document is saved with a unique name. All this happens when the user selects an option on a form, and should be invisible.

    I've tried making a copy of the document, with the unique name and opening that, b ut that causes a whole load of other problems that i'd rather not go into.

  5. #5
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    what if u turn off the word alerts? like this :

    VB Code:
    1. Dim objWordApp as Word.Application
    2. Dim objWordDoc as Word.Document
    3.  
    4.      Set objWordApp = New Word.Application
    5.      objWordApp.DisplayAlerts = wdAlertsNone
    6.      Set objWordDoc = objWordApp.Documents.Open <Path>

    would that do any good ?
    -= a peet post =-

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Isle of Man
    Posts
    276
    that's spot on

    cheers!

  7. #7
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    your welcome Jimbob
    -= a peet post =-

  8. #8
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258
    Or create the document as a template, then it will open a new copy every time.

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