View Word document Read only (from a Viewer?)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LegalIT
    New Member
    • Feb 2008
    • 15

    View Word document Read only (from a Viewer?)

    Hello,

    Using VB.net I want to view a Word document (already created) in Read Only mode. Is there a way to show it in a viewer or something so that it can't be changed or saved under a different name?

    Thanks!
    LegalIT
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by LegalIT
    Hello,

    Using VB.net I want to view a Word document (already created) in Read Only mode. Is there a way to show it in a viewer or something so that it can't be changed or saved under a different name?

    Thanks!
    LegalIT
    You'll have to close it an re-open it as read only

    I'll store the name in a string, then close the file without saving it, then re open it as read only.
    I'll also desactivate the alerts while this is done, because sometimes when VBA closes a document, a Save message appears.

    [CODE=vb]Dim str1 As String
    str1 = activedocument. fullname
    application.dis playalerts = 0
    activedocument. close savechantes:=fa lse
    documents.open filename:=str1, readonly:=true
    application.dis playalerts = -1[/CODE]

    well, hth

    Comment

    Working...