Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Sydney, New South Wales, Australia
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Missing 'Open as read only?' prompt (excel 97)

    I have this VB that tries to open a file
    if the file is not there it asks if the user would like to open the template needed to create that file (that bit works fine)
    Unfortunately if the file does exist , and it is open by another user, it doesn't prompt you with
    "ThatFile.xls is being modified by OtherUser. Open as read only" it just opens the file in read only mode.
    The users don't notice that it is read only. How can I change the VB so it prompts with "Open as read only?"

    Sub OpenOrCreate()
    On Error GoTo ErrorHandler
    Workbooks.Open FileName:="C:FolderThatFile.xls"
    Exit Sub
    ErrorHandler:
    If MsgBox(

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

    Re: Missing 'Open as read only?' prompt (excel 97)

    I don't know if it was already available in Excel 97, but in Excel 2002 the Workbooks.Open method has a boolean argument Notify. Its default value is False; if you use Notify:=True, the user will be notified when the workbook becomes available for editing. But no prompt when the workbook is opened... It might be better to check in advance. See MSKB article Macro Code to Check Whether a File Is Already Open.

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Missing 'Open as read only?' prompt (excel 97)

    FYI,
    Notify is available in XL97 as an OPEN parameter.

    Steve

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

    Re: Missing 'Open as read only?' prompt (excel 97)

    Thanks, Steve.

  5. #5
    Star Lounger
    Join Date
    Apr 2002
    Location
    Sydney, New South Wales, Australia
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Missing 'Open as read only?' prompt (excel 97)

    Thank you Hans and Steve

    The link to the article was perfect.
    I now use a function to see if the file is open. If this function returns true I then have a msgbox that asks if the user would like to open a read only copy.

    Regards

Posting Permissions

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