Results 1 to 2 of 2

Thread: Coding around a 'file in use' message

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2003
    Location
    Milwaukee, WI
    Posts
    9

    Coding around a 'file in use' message

    I am working with an application that uses Word to convert ugly documents into 'pretty' documents...with this application a user has the ability to send a batch file through, because I have several converters running I ran into a problem where their files were being printed out of order from what the batch file was sent. So I fixed this by creating a macro in word to temporarily store the files in a batch to a folder, once all the files in that batch are processed, the marco sends the files to the printer.

    The problem I'm having now is that occasionally I get a "file in use" message, which stops the processing until someone physically chooses an option of either 'Read Only', 'Notify' or 'Cancel'. I'm wondering if there is a way to code my macro to watch for this message and always choose the 'read only' option so that the process doesn't have to be baby-sat. I found a section in my book for error handling, but I need to be able to identify the error number, and there is not an error number on the window message that comes up. Once the 'Read only' button is pressed, the files go on to print like they should.

    Any ideas?

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    This may help (copied from VB Editor Help 'Number Property' - where there is more info.)

    '------------------------------------------
    Sub test()
    On Error GoTo out
    Dim x, y
    x = 1 / y ' Create division by zero error
    Exit Sub
    out:
    MsgBox Err.Number
    MsgBox Err.Description
    ' Check for division by zero error
    If Err.Number = 11 Then
    y = y + 1
    End If
    Resume
    End Sub
    '-------------------------------------------
    Regards
    BrianB
    -------------------------------

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