PB reads Excel data

xiaoxiao2021-03-31  219

// ******************************************************** ************** / / / / Function Name: gf_excel_to_dataWindow // Function: Excel file import dataWindow // Parameter Type: DWTAWINDOW // Parameter Name: DW // Return: 1 succeed -1 Error // Date: 2004 3.1 // ******************************************************* *********************** //

String str_savename, named, s_grxhint excellent, li_netlong li_count, i

oleObject ExcelServeRexcelServer = Create oleObject Excelok = ExcelServer.connecttonewObject ("Excel.Application")

// Check the return value to ensure successfully connected to Excelif Excelok <> 0 Then MessageBox ("Information Tips", "Connection Excel failed, please check if Excel!") Return-hend if li_net = getFileOpenName ( "Select File", Str_SAVENAME, NAMED, "XLS", "Excel file (* .xls), *. Xls") if li_net> 0 Then IF str_savename = "" Then Return -1 dw.settransobject (sqlca) dw.reset () ExcelServer.workbooks.open (str_savename) ExcelServer.Activesheet.cells.copy li_count = dw.importclipboard (2) // Import Data Clipboard ("")

ExcelServer.quit () ExcelServer.disconnectObject () Destroy ExcelServer Return 1ELSE MessageBox ('Information Tips ",' No Specified Import File! ') Return -1END IF

转载请注明原文地址:https://www.9cbs.com/read-130820.html

New Post(0)