Results 1 to 3 of 3

Thread: Ignoring "Read-Only/Notify" alerts when opening Word docs

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    2

    Exclamation Ignoring "Read-Only/Notify" alerts when opening Word docs

    Hi,

    I am new to VBA and am having problems with writing code to open word documents in VBA. Any help would be appreciated!

    My code traverses through a specified folder and finds all the Word documents located there. When it finds these docs, it opens each in turn and executes some code accordingly.

    The problem is that if somebody is currently using that file a dialog box comes up asking the user whether they want to open the file in "Read-Only" or "Notify when read/write is available" mode. This causes my program to stall until the user makes a selection.

    I know in Excel VBA there is a parameter in the Workbooks.Open(...) function called Notify that allows the program to specify this automatically, but there doesn't appear to be an equivalent in Word. Does anybody have any suggestions that may help me out?

    I guess I just need to program to generate an error if a prompt like this is activated so my code can deal with it and not need user input.

    Thanks heaps in advance

    Jill

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    2
    PS- I have tried the following code in order to disable the warning messages, but the "File in use" dialog box still pops up... am I doing anything wrong here??

    THanks heaps!

    *******SAMPLE CODE********************

    Sub FindLinkedDocuments()

    Word.Application.Visible = False
    Application.ScreenUpdating = False
    Word.Application.DisplayAlerts = wdAlertsNone
    Excel.Application.DisplayAlerts = False

    <my code>

    Word.Application.DisplayAlerts = wdAlertsAll
    Excel.Application.DisplayAlerts = True
    Application.ScreenUpdating = False
    Word.Application.Visible = True


    End Sub

  3. #3
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    I don't know off the top of my head but is there not an
    Code:
    If [wordDOC].locked = true
    or the like?
    ?
    'What's this bit for anyway?
    For Jono

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