Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prevent editing in Web Browser
Message
From
23/12/2008 08:53:36
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
To
23/12/2008 07:55:31
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01368880
Message ID:
01369337
Views:
14
>>Cetin,
>>
>>My mistake. It does indeed prevent editing of the spreadsheet. I had to put the wait for ready state in before it would work.
>>
>>The issue now is that even though I do not make any changes (your code prevents it), it always prompts with:
>>
>>
>>This document has been modified. Do you want to save changes?
>>
>>	Yes:	Saves your changes
>>	No:	Discards your changes
>>	Cancel:	Keeps this document open
>>
>>
>>When I open any subsequent documents. Any Idea why this would be happening?
>>
>>Thanks.
>>Mike
>>
>>
>>>I don't understand why it fails there.
>>>
>>>
lcXLSFile = Getfile('xls')
>>>
>>>#Define xlNoRestrictions                                  0
>>>#Define xlUnlockedCells                                   1
>>>#Define xlNoSelection                                     -4142
>>>
>>>Public oForm
>>>oForm = Createobject('myExcelForm',m.lcXLSFile)
>>>oForm.Show()
>>>
>>>Define Class myExcelForm As Form
>>>  Top = 0
>>>  Left = 0
>>>  Height = 450
>>>  Width = 750
>>>  Caption = "HTML Excel sample"
>>>
>>>  Add Object htmlviewer As OleControl With ;
>>>    top = 0, ;
>>>    left = 0, ;
>>>    height = 450, ;
>>>    width = 750, ;
>>>    anchor= 15, ;
>>>    visible = .T., ;
>>>    name = "HTMLViewer", ;
>>>    oleclass = 'Shell.Explorer'
>>>
>>>  Procedure Init
>>>    Lparameters tcXLSFile
>>>    With Thisform.htmlviewer
>>>      .Navigate2('file://'+m.tcXLSFile)
>>>      Do While .ReadyState # 4 && Wait for ready state
>>>      Enddo
>>>      oXLS = .Object.Document
>>>      oExcel = oXLS.Application
>>>      oExcel.CommandBars("Standard").Visible = .F.
>>>      oExcel.CommandBars("Formatting").Visible = .F.
>>>      oExcel.ActiveWorkbook.ActiveSheet.EnableSelection = xlNoSelection
>>>      oExcel.ActiveWorkbook.ActiveSheet.Protect(,,.T.,,.T.)
>>>    Endwith
>>>  Endproc
>>>Enddefine
>>>
Cetin
>
>I don't know but you can prevent it by adding:
>
oExcel.DisplayAlerts = .f.
>oExcel.ActiveWorkbook.Saved = .t.
Cetin


That did it. I had to remove the oExcel.DisplayAlerts=.f. since it kept giving an error, "The parameter is incorrect".
Anyway, thank you for helping me with this.

Mike
Previous
Reply
Map
View

Click here to load this message in the networking platform