ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   webrowser - excel - deny modifications (https://www.excelbanter.com/excel-programming/351390-webrowser-excel-deny-modifications.html)

herb

webrowser - excel - deny modifications
 
Hello,

I've following situation:

From a external VBE application (not MS) i open a excel file in a

webbrowser.

Of course it's possible now to edit th excel sheet.

Is it possible to prevent modifications in the loaded excel sheet?

i tried it with disabling the excel alert:

webbrowser1.application.DisplayAlerts = false

.... but it didnt work

Thanks in advance.....


NickHK

webrowser - excel - deny modifications
 
herb,
Don't know about the webbrowser control, but the OLE control can be set to
Interactive=false.
The OLE control takes a little get used to.

NickHK

"herb" wrote in message
ups.com...
Hello,

I've following situation:

From a external VBE application (not MS) i open a excel file in a

webbrowser.

Of course it's possible now to edit th excel sheet.

Is it possible to prevent modifications in the loaded excel sheet?

i tried it with disabling the excel alert:

webbrowser1.application.DisplayAlerts = false

... but it didnt work

Thanks in advance.....




herb

webrowser - excel - deny modifications
 
thanks for the reply....

i didn't work.... i've tried this:

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As
Variant)

Set m_oDocument = pDisp.Document

m_oDocument.Application.Interactive = False

End Sub


.... with the effect that nothing happens


the problem is, that the data on the excel sheet are a kind of report,
which of course should be not modified.....


NickHK

webrowser - excel - deny modifications
 
herb,
No, the OLE control has a .Interactive property.
I do not know about the webbrowser control.
Do you have to use the webbrowser ?

NickHK

"herb" wrote in message
oups.com...
thanks for the reply....

i didn't work.... i've tried this:

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As
Variant)

Set m_oDocument = pDisp.Document

m_oDocument.Application.Interactive = False

End Sub


... with the effect that nothing happens


the problem is, that the data on the excel sheet are a kind of report,
which of course should be not modified.....




fernando

webrowser - excel - deny modifications
 
Hi,

if you have access to the excel file you may protect the workbook (and
worksheets).

If not, you may protect the workbook via automation. the workbook (or
maybe worksheet) object should be accesible under the
webbrowser1.document property

hope this helps,

fernando


herb

webrowser - excel - deny modifications
 
fernando schrieb:

Hi,

if you have access to the excel file you may protect the workbook (and
worksheets).

If not, you may protect the workbook via automation. the workbook (or
maybe worksheet) object should be accesible under the
webbrowser1.document property

hope this helps,

fernando



hi,

the webbrowser in vbe doesnt support

webbrowser1.Interactive=false


the reports are generated automatically from an application, so it is
not possible to protect the worksheet while generated.


is it possible to overlay an invisible window to the webbrowser?


hmm.... i'm running out of ideas.....


fernando

webrowser - excel - deny modifications
 
Hi,

I checked the reference for the webbrowser control and I didn't find
the property you want to use.

I also have no idea what application you are using (VB6 / VBA, other?).
Anyway, I hope the code below helps:

'just a Form and a WebBrowser control in VB6 / VBA

Private Sub Form_Load()
'a reference to the excel object library must be declared
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet

'just open any excel file in the webbrowser control
Me.WebBrowser1.Navigate "C:\Mis documentos\libro3.xls" ' change
this file

'the document property in the WebBrowser control is the
Excel.Workbook object
Set wb = Me.WebBrowser1.Document

'once you have access to the Workbook object, you can do pretty
much what you
'like, in this case: protecting the Worksheets

'loop through the worksheets and protect each
For Each ws In wb.Worksheets
ws.Protect
Next

Set ws = Nothing
Set wb = Nothing
End Sub


fernando

webrowser - excel - deny modifications
 
I almost forgot: webbrowser reference:
http://msdn.microsoft.com/library/de...reflist_vb.asp


herb

webrowser - excel - deny modifications
 
hello fernando,

the problem was that the excel sheet should be protect before
displaying.

Private Sub Webbrowser1_NavigateComplete2(ByVal pDisp As Object, URL As
Variant)

.... here the protection-procedure which you have mentioned...

End Sub


....with this it works...


thanks for you help,

Herb



All times are GMT +1. The time now is 09:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com