As the subject, I have a XLS file and it has a password. So, how to input it in order to open it?
Regards,
Kleyber wrote:Hi Enrico,
As usual, your help is fantastic. Just one more question: How to see the order of all the ::open() parameters? Can you show me?
Thanks a lot.
Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMRU)
#include "fivewin.ch"
FUNCTION main( fileXL )
LOCAL oExcel, oWorkbook, nSheets
oExcel := TOLEAuto():New( "Excel.Application" )
oExcel:Visible := .t.
oExcel:UserControl := .t.
oWorkbook := oExcel:Workbooks
oWorkbook:Open( fileXL )
oActiveWorkBook := oExcel:ActiveWorkBook
XLSisProtected( 1, oExcel:ActiveWorkBook, "" )
nSheets := oActiveWorkBook:Sheets:Count()
For i = 1 To nSheets
oWS := oActiveWorkbook:Worksheets(i)
oWS:Activate()
XLSisProtected( 2, oWS, oWS:Name )
Next
oExcel:End()
//oWorkbook:Open( fileXL,,,, "xlstest" )
RETURN NIL
*
* *
* FUNCTION: Test if XLS file is protect
* *
*
FUNCTION XLSisProtected(n,oOBJ,sName)
LOCAL isP := .t.
If n==1
isP := oOBJ:ProtectWindows
isP := oOBJ:ProtectStructure
If isP
MsgStop( "IS Protected", "WorkBook Protection" )
Else
MsgStop( "IS NOT Protected", "WorkBook Protection" )
EndIf
Else
isP := oOBJ:ProtectContents
isP := oOBJ:ProtectDrawingObjects
isP := oOBJ:ProtectScenarios
If isP
MsgStop( "IS Protected", "WorkBook "+sName+" Protection" )
Else
MsgStop( "IS NOT Protected", "WorkBook "+sName+" Protection" )
EndIf
EndIf
Return(isP)
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 68 guests