4 posts in this topic
I was looking for a method with rename an Excel Sheet, but I didn't find a lot...
So, I decided to make it in another way...
Since I have to create a new Workbook, I thought that, creating a new Workbook, deleting the existing sheet, and adding a new one, would be almost the same...
But I'm encountering a lot of issues, both when I delete the sheet and when I add the new sheet...
This is what I do:
; Create the Excel Object... Local $oExcel_PRV_HW = _Excel_Open(False) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la creazione dell'oggetto Excel." & @CRLF & "Errore: " & @error & @CRLF & "Esteso: " & @extended) Else ; Create the Workbook with 1 worksheet... Local $oWorkbook_New = _Excel_BookNew($oExcel_PRV_HW, 1) ; Save the Workbook in order to open it and work with it... _Excel_BookSaveAs($oWorkbook_New, $sFilePreventivo, $xlOpenXMLWorkbook, True) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante il salvataggio della cartella di lavoro." & @CRLF & "Errore: " & @error) EndIf ; Open the Workbook to work with... Local $oWorkbook_PRV_HW = _Excel_BookOpen($oExcel_PRV_HW, $sFilePreventivo) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file '" & $sFilePreventivo & "'." & @CRLF & "Errore: " & @error) Else ; Here I would add the _Excel_SheetDelete() and _Excel_SheetAdd() as I did, but they return errors... EndIf EndIf Can someone help me out, please? Thanks
I think i´m doing something wrong. In the following code, _excel_RangeFind() does not find all occurrences. From sheet1 to sheet9 it does not find the occurrence of row 1, and on sheet10 it find it, but puts it last. Where am I wrong? Thank you very much and sorry for my inglish. The code: #include <Excel.au3> Local $oAppl = _Excel_Open(True) Local $oWorkbook= _Excel_BookNew($oAppl, 10) Local $namesheet= "hoja";<-- Default name for sheet in spanish language: hoja1, hoja2, hoja3 etc. For $x= 1 to 10;<-- $x completes the name of the excel sheet: $namesheet & $x for $y= 1 to 5 _Excel_RangeWrite($oWorkbook, $namesheet & $x , "sofia" & " " & $namesheet & $x & " " & $y,"A" & $y) Next Next Local $search= _Excel_RangeFind($oWorkbook, "sof") _ArrayDisplay($search) This is using 3.3.12 version and office 2007.
I am a beginner and I am currently learning and practicing what Autoit can do, so kindly pardon if it sound's silly.
What my program does ----> I had written a program where I have a FOR (i=0 to n) loop which is running for n times. Inside the FOR loop, contents of array is written into excel using _Excel_RangeWrite .
_Excel_RangeWrite($oExcelDoc, $oExcelDoc.Activesheet, $arrayname, "A1") Problem ------> During every loop run the contents of column A is only altered
What i intend to do ------> For every loop run (i=0,1,2,3...) I want to write the array contents into respective next adjacent excel columns
i.e) For i=0 loop, every array content should be written in A Column of excel
For i = 1 loop, every array content should be written in B Column of excel.
Can anyone give me an idea of how can i do this? Thanks
Why is my code not writing X in cell D1?
#include <Excel.au3> Global $r = 1,$oExcel Excel () Func Excel() While ProcessExists("EXCEL.EXE") $ms = MsgBox(5,"","Process error. You have an Excel sheet open. You must close it in order to let this program work. Please close it now.") If $ms=2 Then Exit WEnd Local $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)") If FileExists($sExcelFile) Then $oExcel = _Excel_Open () $oWorkbook = _Excel_BookOpen($oExcel,$sExcelFile) ;this will open the chosen xls file. Else $oExcel = _Excel_Open() $oWorkbook = _Excel_BookNew($oExcel, 2);this is here to create the xls file if it does not exist. EndIf EndFunc Sleep (2000) _Excel_RangeWrite($oExcel,Default, "X", "D" & $r) Exit
I want to select an excel file from a folder using selenium. The file name includes the data stamp. But, only that file will be existing in the folder. How to do it please help with the code