+ Reply to Thread
Results 1 to 9 of 9

Thread: webrowser -> excel -> deny modifications

  1. #1
    herb
    Guest

    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.....


  2. #2
    NickHK
    Guest

    Re: 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" <h_boulder@gmx.at> wrote in message
    news:1138155524.187845.34940@o13g2000cwo.googlegroups.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.....
    >




  3. #3
    herb
    Guest

    Re: 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.....


  4. #4
    NickHK
    Guest

    Re: 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" <h_boulder@gmx.at> wrote in message
    news:1138160125.756412.190760@z14g2000cwz.googlegroups.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.....
    >




  5. #5
    fernando
    Guest

    Re: 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


  6. #6
    herb
    Guest

    Re: 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.....


  7. #7
    fernando
    Guest

    Re: 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


  8. #8
    fernando
    Guest

    Re: webrowser -> excel -> deny modifications

    I almost forgot: webbrowser reference:
    http://msdn.microsoft.com/library/de...reflist_vb.asp


  9. #9
    herb
    Guest

    Re: 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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0