Link to home
Start Free TrialLog in
Avatar of ihtzaz
ihtzaz

asked on

Read only object in Web Browser control

I am using a Web Browser control in a VB application. When a word document is shown in the browser control, one can edit the document.  I want to control that i.e. I would like some of my users to just view the document and some to edit.  How do I set the read-only kind of property.
ASKER CERTIFIED SOLUTION
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops!

Option Explicit
Dim bEnableEdit As Boolean

Private Sub Form_Load()
WB1.Navigate "C:\temp\Attachs\hadas.doc"
bEnableEdit = False
End Sub

Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WB1.Object) Then
    If Right$(WB1.LocationURL, 3) = "doc" Then
        Dim oTarget As Word.Document
        Set oTarget = WB1.Document
        If bEnableEdit = False Then
            oTarget.Protect Type:=wdAllowOnlyComments, Password:="pwd"
        End If
       
    End If
End If
End Sub
Any progress?
Hi ihtzaz,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Richie_Simonetti's comment(s) as an answer.

ihtzaz, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Avatar of Netminder
Netminder

Per recommendation, force-accepted.

Netminder
CS Moderator