Dennis-
PMFJI, but here is a possible solution.
ox = CREATEOBJECT( 'excel.application' )
ox.visible = .T.
ox.Open( GETFILE( "xls" ), , , , cOpenPassword, cWritePassword )
Whether it's helpful to you depends partly on what version of Office. I'm using Office 2000 VBA syntax, which may be the same for Office 97. It also depends on whether you have the password accessible to you in your app through asking for it from your user, say. If you don't then
ON ERROR ReturnAndDoSomethingSensible
BTW, the help for Excel VBA can be found in either: VbaXl8.hlp (Version 97 ) or Vbaxl9.chm Version 2000 (or 9.0). If you don't have the help file for your version of Office installed, then reinstall components, since it's not a default option.
HTH
>When execute this coding,
>MBUDVAR = GetObject(cExcelFile) && the cExcelFile is variable which contain the file name of Excel Worksheet &&
>the OLE 0x80004005 would be occured, how can i solve this.
>Sorry, I missed one important point that is the error is only occured when the excel worksheet has password protected. Therefore when EXCEL prompt me to enter the password, if I input the wrong password, press cancel/ok, the error will be occured. If in the case, how can I only the record down the filename and error message, and the program will still processing.