Code:
F_openexcel (as_filename)
//as_filename//Excel file
Int li_ret
Oleobject lole_excel
Lole_excel=create oleobject
Li_ret=lole_excel. ConnectToObject (' Excel. Application ')
If li_ret & lt;> 0 Then
Li_ret=lole_excel. ConnectToNewObject (' Excel. Application ')
If li_ret & lt;> 0 Then
Messagebox (' mistakes', 'open the EXCEL failed! ')
The return - 1
End the If
End the If
If not FileExists (as_filename) Then
Lole_excel. DisconnectObject ()
Messagebox (' mistakes', 'file does not exist! ')
The return - 1
End the If
//OLE open the EXCEL file
//as_filename is by PB OLEStorage, OLEStream stored as Excel files,
lole_excel. Application. Workbooks. Open (as_filename) //as_filename files larger than 1 m is an error, can't Open it,
If not isvalid (lole_excel. Application. Activeworkbook) then
Lole_excel. Application. Workbooks. The close ()
Lole_excel. Application. The quit ()
Lole_excel. Disconnectobject ()
Destroy lole_excel
The return - 1
End the if
//because of the need to open the excel file processing,
//any other method or solution,
CodePudding user response:
//tested before version of office 2013 error, office2013 is not an error,
CodePudding user response:
Lole_excel. Application. Workbooks. Open (as_filename)To:
Ole_excel. Workbooks. Open (ls_filename)
Tested, opens the file at 1 m under the pb10 no problem, it is possible that the generated files you have any question, you can also try to find a more than 1 m file, don't use your own generation
CodePudding user response:
Is concerned about the problem how to solveCodePudding user response:
Judgment should be transferred out file has a problem, is also encounter this problem, but the dw2xls too complicated, it's hard to chew