Func SaveWorkerTable();;汇出资料
$MyDocsFolder = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
$FileSavePath = FileSaveDialog("选择储存位置", $MyDocsFolder, "Excel档 (*.xls)|所有档 (*.*)" , 2 + 16 , "人员资料_"&@YEAR&@MON&@MDAY&'-'&@HOUR&@MIN&@SEC)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $DBName & ";Jet Oledb:Database Password="&$mdb_data_pwd)
$RS =ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open ("Select * From " & $DBEnterpriseTable )
Local $oExcel = _ExcelBookNew(0);;Create new book, make it visible
; Write something into cell
_ExcelWriteCell($oExcel,'索引号',1,1)
_ExcelWriteCell($oExcel,'统一编号',1,2)
_ExcelWriteCell($oExcel,'厂商名称',1,3)
_ExcelWriteCell($oExcel,'人员姓名',1,4)
_ExcelWriteCell($oExcel,'市话',1,5)
_ExcelWriteCell($oExcel,'传真',1,6)
_ExcelWriteCell($oExcel,'手机',1,7)
_ExcelWriteCell($oExcel,'地址',1,8)
_ExcelWriteCell($oExcel,'备注事项',1,9)
while Not $RS.eof And Not $RS.bof
if @error =1 Then ExitLoop
$i = 1
$n = $i + 1
_ExcelWriteCell($oExcel,$RS.Fields(0).value,$n,1)
_ExcelWriteCell($oExcel,$RS.Fields(1).value,$n,2)
_ExcelWriteCell($oExcel,$RS.Fields(2).value,$n,3)
_ExcelWriteCell($oExcel,$RS.Fields(3).value,$n,4)
_ExcelWriteCell($oExcel,$RS.Fields (4).value&"-"& $RS.Fields (5).value&"-"& $RS.Fields (6).value&"#"& $RS.Fields (7).value,$n,5)
_ExcelWriteCell($oExcel,$RS.Fields (8).value&"-"& $RS.Fields (9).value&"-"& $RS.Fields (10).value,$n,6)
_ExcelWriteCell($oExcel,$RS.Fields (11).value&"-"& $RS.Fields (12).value&"-"& $RS.Fields (13).value&"#"& $RS.Fields (7).value,$n,7)
_ExcelWriteCell($oExcel,$RS.Fields(14).value,$n,8)
_ExcelWriteCell($oExcel,$RS.Fields(15).value,$n,9)
$rs.movenext
WEnd
$rs.close
$addfld.Close
_ExcelBookSaveAs($oExcel,$FileSavePath,'xls',0,1)
_ExcelBookClose($oExcel)
MsgBox (64,"完成","已成功储存档案!" & @CRLF & @CRLF & "档案路径为:" & $FileSavePath)
Return
EndFunc