Jump to content

Soulstorm

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Soulstorm

  1. Oh thanks water. once again! Excel-SAP.au3 (11) : ==> COM Error intercepted ! err.number is: 0x80020009 err.windescription: Ausnahmefehler aufgetreten. err.description is: Dieser Befehl kann für ein geschütztes Blatt nicht verwendet werden. Sie müssen zuerst den Schutz des Blatts aufheben (Registerkarte 'Überprüfen', Gruppe 'Änderungen', Schaltfläche 'Blattschutz aufheben'), um diesen Befehl zu verwenden. Sie werden möglicherweise aufgefordert, ein Kennwort einzugeben. err.source is: Microsoft Excel err.helpfile is: xlmain11.chm err.helpcontext is: 0 err.lastdllerror is: 0 err.scriptline is: 11 err.retcode is: 0x800A03EC It all makes sense right now.. my excel file was protected.
  2. Excel 2013, in German (if it makes a difference..)
  3. yup! It's weird because: $oWorkbook.Sheets(1).Range("B22").Activate works perfectly! But $oRange = $oWorkbook.ActiveSheet.UsedRange.SpecialCells($xlCellTypeLastCell) does not! (with ActiveSheet and Sheets(1))
  4. I don't seem to be able tu use this "SpecialCells($xlCellTypeLastCell)" function in: $oRange = $oWorkbook.Sheets(1).UsedRange.SpecialCells($xlCellTypeLastCell)
  5. Thanks for your answer! Unfortunately I already tried this: #include <Excel.au3> #include <MsgBoxConstants.au3> ; Create application object or connect to an already running Excel instance Local $oExcel = _Excel_Open() Local $aWorkBooks = _Excel_BookList() Local $oWorkbook =_Excel_BookAttach ($aWorkbooks[0][1],"FileName") $oWorkbook.Sheets(1).Range("B22").Activate $oRange = $oWorkbook.Sheets(1).UsedRange.SpecialCells($xlCellTypeLastCell) With the same error in the end: "X:\Abteilungen\Industrialisation\Oeffentlich\0xxxxx\xxxxxx\02_Aufgaben\Scripts\xxxxx\Excel-SAP.au3" (9) : ==> The requested action with this object has failed.: $oRange = $oWorkbook.Sheets(1).UsedRange.SpecialCells($xlCellTypeLastCell) $oRange = $oWorkbook.Sheets(1).UsedRange^ ERROR >Exit code: 1 Time: 1.644
  6. Hello everyone! #include <Excel.au3> #include <MsgBoxConstants.au3> ; Create application object or connect to an already running Excel instance Local $oExcel = _Excel_Open() $workBookList=_Excel_BookList() Local $oWorkbook =_Excel_BookAttach ($workBookList[0][1],"filename") $oWorkbook.Sheets(1).Range("B22").Activate $LastRow = $oWorkbook.Sheets(1).Range("B22").SpecialCells($xlCellTypeLastCell).Row >"C:\Users\xxxx\Downloads\install\SciTe\..\autoit3.exe" /ErrorStdOut "X:\Abteilungen\Industrialisation\Oeffentlich\xxxxx\201704 xxxxx\02_Aufgaben\Scripts\xxxxxx\Excel-SAP.au3" "X:\Abteilungen\Industrialisation\Oeffentlich\xxxxx\xxxxx\02_Aufgaben\Scripts\xxxxx\Excel-SAP.au3" (10) : ==> The requested action with this object has failed.: $LastRow = $oWorkbook.Sheets(1).Range("B22").SpecialCells($xlCellTypeLastCell).Row $LastRow = $oWorkbook.Sheets(1).Range("B22")^ ERROR >Exit code: 1 Time: 2.522 I tried almost everything and looked everywhere on the forum and I can't pinpoint the issue in my code. I have an excel Workbook which is already open, prior to the script. I then list all the available excel workbooks (there is only one). I create my Workbook object (using the filename) and focuses on the cell "B22" (It works!). And now I want to simply find the last used cell in column B. But for some reaso, it won't work. For some really weird reasons this work perfectly on another script, the only difference is that I use an excel file which not already opened: $oExcel = ObjCreate("Excel.Application") $oBook = $oExcel.Workbooks.Open("I:\Oeffentlich\xxx\BDE\Datenstruktur BDExxx.xlsx") $oSheet = $oBook.Activesheet $oExcel.Visible = True $LastRow = $oBook.ActiveSheet.Range("B1").SpecialCells($xlCellTypeLastCell).Row + 1 ;$oBook.ActiveSheet.Range("B"&$LastRow).Activate
×
×
  • Create New...