Avatar of Ngonzaga
Ngonzaga
Flag for Brazil asked on

How to make a office viewer (read-only)?

Hi all,
I make a form in an VB application with a WebBrowser to show a .doc file using this:
WebBrowser1.Navigate2 Text1.Text
The question is how can I disable some keys to avoid changes and/or save the doc? or
How can I show a .doc file read-only, using free tools?

tks,

Visual Basic ClassicMicrosoft Word

Avatar of undefined
Last Comment
Ngonzaga

8/22/2022 - Mon
3_S

This is a word viewer from microsoft. It alows you to view a document.  You can save but not in ms word format.
http://www.microsoft.com/downloads/details.aspx?FamilyId=95E24C87-8732-48D5-8689-AB826E7B8FDF&displaylang=en
Ngonzaga

ASKER
I need only a viewer, without print, save, save as, copy or edit. Using word viewer I can disable this options ?
3_S

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Ngonzaga

ASKER
Ok 3_S,
I will use word viewer, controlling the DocumentSave event, but which file I put(check) in Project/references? Or which component I use?
There aren't any olb, tlb, dll or ocx in the word viewer(...\OFFICE11) folder registered to use,
like a MSWORD9.OLB I use at this moment.
Tks,
3_S

The word viewer cannot be automated
http://support.microsoft.com/kb/189609

I only had experience with the powerpoint and access snapshot viewer.  So I did some testing with the viewer.  There is no need to limit the possiblity to save.  It's not available in the viewer.
The only thing you can do is print and select the whole content of the document and copy this to the clipboard.  Then with an other program you can save this. If the full MS word is not available on the computer you cannot make a word document.
To open a document with the viewer see attached code (it takes the default program attached to the extension, so this means word viewer must be attached to .doc)

Do the users have the full MS office installed on their computer?

If you realy want to prevent users from overwriting of modifying the content of a file use NTFS permissions to prevent this. (Give only read right to this file/folder/network share)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
 
 
    ShellExecute Me.hwnd, vbNullString, "c:\mydocument.doc", vbNullString, "C:\", SW_SHOWNORMAL

Open in new window

Ngonzaga

ASKER
My big problem is my users using staroffice, office 2000, office 2003, and so on. I need a viewer to unify this.
The users doesn't accept the solution above because the .doc files must be associate to winword.
I need another way to do is.

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
3_S

Then secure the file using NTFS security. Then it will always open read-only if they have only read-only rights.
Or do the file do not have a fixed location?
Ngonzaga

ASKER
I use this and works fine:
Shell "C:\Program Files\Microsoft Office\OFFICE11\WORDVIEW.EXE " & Chr(34) & Text1.Text & Chr(34)
But,
1) Is there a way to indicate the left, top, width and height of the wordviewer? To put just a place in the form, maybe there is a dll to do it.
2) How I cancel the menu bar to avoid print, open for edition, etc?
ASKER CERTIFIED SOLUTION
3_S

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
3_S

There are many third party control  in which you can control this all.  But none are free as far as I know.
So you will have to make a chose.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Ngonzaga

ASKER
Well 3_S,
I will accept your answer and give the points to you, but, is very far from a solution to my problem. I will continue looking for a viewer or I will make one using the wordviewer and some dll.

tks,