Search the Community
Showing results for tags 'sheet'.
-
Good morning 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