uibot獲取excel指定行資料並輸出到新的excel邊
阿新 • • 發佈:2022-04-19
Dim objRet ,objRet1,objRet2= "" Dim arrSet = "" Dim arrayRet = "" Dim objExcelWorkBook = "" objExcelWorkBook = Excel.OpenExcel('''E:\老人卡\20220417訂單資料.xlsx''',False,"Excel","","") Dim rownum = 340 //行號 arrayRet = Excel.ReadRange(objExcelWorkBook,"65週歲敬老卡","A"&rownum&":K"&rownum+99) Excel.CloseExcel(objExcelWorkBook,True) objExcelWorkBook= Excel.OpenExcel('''E:\老人卡\XXXXX操作員.xlsx''',False,"Excel","","") Excel.WriteRange(objExcelWorkBook,"Sheet1","A2:K101",arrayRet,False) objRet = Excel.ReadCell(objExcelWorkBook,"Sheet1","B2") Excel.WriteRange(objExcelWorkBook,"Sheet1","A2:K101",arrayRet,True) objRet1 = Excel.ReadCell(objExcelWorkBook,"Sheet1","B2") Dim B1 B1 = CStr(objRet1) //Excel.WriteCell(objExcelWorkBook,"Sheet1","B1","'"&B1,True) objRet2 = Excel.ReadCell(objExcelWorkBook,"Sheet1","B101") //讀取最後一行的序列 Dim B2 B2 = CStr(objRet2) Excel.WriteCell(objExcelWorkBook,"Sheet1","C1",B1&"-"&B2,True) Excel.CloseExcel(objExcelWorkBook,True)