Silvinho Posted March 4, 2008 Posted March 4, 2008 How I do write values in the excel worksheet, then call other worksheet and it do it to write the same values?. See my script below.... thank #include <ExcelCOM_UDF.au3> ; Include the function collection ; Open new book, make it visible ;Local $oExcel = _ExcelBookNew(1) $oExcel = ObjCreate("Excel.Application") $oExcel.visible=1 $oExcel.WorkBooks.open("C:\Registro de Inspecao.xls") _ExcelWriteCell($oExcel, "Mauricio", "B6") _ExcelWriteCell($oExcel, "STA", "E4") _ExcelWriteCell($oExcel, "3-baixa", "E6") _ExcelWriteCell($oExcel, "27/02/2008", "E8") _ExcelWriteCell($oExcel, "27/02/2008", "E8") _ExcelWriteCell($oExcel, "27/02/2008", "E10") _ExcelWriteCell($oExcel, "00:20", "E12") _ExcelWriteCell($oExcel, "ECP", "E14") ; Itens do Check List _ExcelWriteCell($oExcel, "SIM", "C24") _ExcelWriteCell($oExcel, "SIM", "C25") _ExcelWriteCell($oExcel, "NÃO", "C26") _ExcelWriteCell($oExcel, "1", "D26") _ExcelWriteCell($oExcel, "Descrever o nome completo do Autor", "F26") _ExcelWriteCell($oExcel, "N/A", "C27") _ExcelWriteCell($oExcel, "N/A", "C28") _ExcelWriteCell($oExcel, "SIM", "C29") _ExcelWriteCell($oExcel, "SIM", "C30") _ExcelWriteCell($oExcel, "SIM", "C31") _ExcelWriteCell($oExcel, "SIM", "C32") _ExcelWriteCell($oExcel, "N/A", "C33") _ExcelWriteCell($oExcel, "SIM", "C34") _ExcelWriteCell($oExcel, "SIM", "C36") _ExcelWriteCell($oExcel, "Esta MIG não é de integração, "F36") _ExcelWriteCell($oExcel, "N/A", "C37") _ExcelWriteCell($oExcel, "SIM", "C38") _ExcelWriteCell($oExcel, "SIM", "C39") _ExcelWriteCell($oExcel, "SIM", "C40") _ExcelWriteCell($oExcel, "SIM", "C41") _ExcelWriteCell($oExcel, "SIM", "C43") _ExcelWriteCell($oExcel, "SIM", "C45") _ExcelWriteCell($oExcel, "SIM", "C46") _ExcelWriteCell($oExcel, "SIM", "C47") MsgBox(0, "", "RI executada com sucesso",3) ; And finally we close out _ExcelBookClose($oExcel)
smashly Posted March 4, 2008 Posted March 4, 2008 (edited) Hi, same thing as you wrote using a loop to fill the same data.#include <ExcelCOM_UDF.au3> ; Include the function collection Global $xlsData = StringSplit("Mauricio,B6|STA,E4|3-baixa,E6|27/02/2008,E8|27/02/2008,E10|00:20,E12|" & _ "ECP,E14|SIM,C24|SIM,C25|NÃO,C26|1,D26|Descrever o nome completo do Autor,F26|" & _ "N/A,C27|N/A,C28|SIM,C29|SIM,C30|SIM,C31|SIM,C32|N/A,C33|SIM,C34|SIM,C36|" & _ "Esta MIG não é de integração,F36|N/A,C37|SIM,C38|SIM,C39|SIM,C40|SIM,C41|" & _ "SIM,C43|SIM,C45|SIM,C46|SIM,C47", "|") $oExcel = ObjCreate("Excel.Application") $oExcel.visible=1 $oExcel.WorkBooks.open("C:\Registro de Inspecao.xls") _EWC($xlsData) MsgBox(0, "", "RI executada com sucesso",3) ; And finally we close out _ExcelBookClose($oExcel) Func _EWC($eData) For $i = 1 To $eData[0] Local $esd = StringSplit($eData[$i], ",") _ExcelWriteCell($oExcel, $esd[1], $esd[2]) Next EndFunc Edit: oops I think I should have read your post properly, so your wanting write the same data into multiple worksheets.. Are all your .xls files in 1 directory? Cheers Edited March 4, 2008 by smashly
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now