By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

View Word document Read only (from a Viewer?)

LegalIT
P: 15
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
Apr 22 '08 #1
Share this Question
Share on Google+
1 Reply


kadghar
Expert 100+
P: 1,295
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.

Expand|Select|Wrap|Line Numbers
  1. Dim str1 As String
  2. str1 = activedocument.fullname
  3. application.displayalerts = 0
  4. activedocument.close savechantes:=false
  5. documents.open filename:=str1, readonly:=true
  6. application.displayalerts = -1
well, hth
Apr 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.