none
VSTO 2010 Excel: How to Determine That Workbook Is Open in "Server Read-Only" Mode? RRS feed

  • Question

  • Hi

    I am developing a Excel 2010 VSTO document customization (template).

    My users store the documents created from this template on a SharePoint site. When they open the document from SharePoint in read-only mode, this is indicated in Excel in several ways:

    • the window caption shows the workbook name followed by [Read-Only]
    • below the Office Ribbon, a large yellow message bar says: Server Read-Only - this workbook was openedfrom a server in read-only mode
    • the same information is also displayed in File > Info

    In the ThisWorkbook_Open event:

    • ThisWorkbook.ReadOnly returns false
    • I have tried to find out if ThisWorkbook.SharedWorkspace contains any useful information: it is always null even though the VSTO 2010 documentation says it is never Nothing. (is this a bug or is it only in VB.Net that it is never Nothing?)

    Can Microsoft point out a way to determine through code whether a workbook was opened in Server Read-Only mode? 

    Note: the same issue is discussed in this (still not answered) thread:

    http://social.msdn.microsoft.com/forums/en-us/vsto/thread/C9A89140-9073-4659-8646-E80141661F29

    Georg

    Friday, August 10, 2012 10:54 PM

All replies

  • Hi GerogU,

    Thanks for posting in the MSDN Forum.

    I will involve some experts into this issue to see whether they can solve your issue. There might be some time delay, appreciate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, August 13, 2012 6:07 AM
    Moderator
  • Hi Georg,

    Try editing the workbook just enough to set the dirty flag then saving it in a try...catch call to determine whether you get a message saying you an't save it because it is read-only.

    Please share the results of your exploration. Thanks


    Please remember to mark the replies as answer if they help and unmark them if they provide no help. and click "Vote as Helpful" this and other helpful posts, so other users will see your thread as useful. Best Regards, Chris Jensen

    Monday, August 13, 2012 7:57 PM
    Moderator