nicky40 Posted April 16, 2009 Share Posted April 16, 2009 I gave away 10 bucks earlier to the fixer of my saving excel file issues, but now I'm trying to open an already formatted excel spreadsheet for editing via my script. CODE$oExcel = ObjCreate("Excel.Application") $oExcel.Application.Workbooks.Open("C:\StartingPoint.xls") Is there an easier way to do this that doesn't fail when I run it? I can post my full code below to try to get some context of what I'm trying to accomplish. CODE$oExcel = ObjCreate("Excel.Application") $oExcel.Application.Workbooks.Open("C:\StartingPoint.xls $oExcel.Workbooks.Add $oExcel.Sheets("sheet1").Select $oExcel.Range("A1").Value="File Name" $oExcel.Range("A3").Value=$Preversion & $Version1 $oExcel.Range("C1").Value="Quantity" $oExcel.Range("C3").Value=$Count1 $oExcel.Range("E1").Value="Issue" $oExcel.Range("E3").Value=$CoverDate $oExcel.Range("G1").Value="Description" $oExcel.Range("G3").Value=$SF 5 Bucks via paypal to whoever can sucessfully provide me a solution first! Aim= Klufas15 MSN = Klufas15@hotmail.com Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 16, 2009 Share Posted April 16, 2009 I gave away 10 bucks earlier to the fixer of my saving excel file issues, but now I'm trying to open an already formatted excel spreadsheet for editing via my script. $oExcel = ObjCreate("Excel.Application") $oExcel.Application.Workbooks.Open("C:\StartingPoint.xls") Is there an easier way to do this that doesn't fail when I run it? I can post my full code below to try to get some context of what I'm trying to accomplish. CODE$oExcel = ObjCreate("Excel.Application") $oExcel.Application.Workbooks.Open("C:\StartingPoint.xls $oExcel.Workbooks.Add $oExcel.Sheets("sheet1").Select $oExcel.Range("A1").Value="File Name" $oExcel.Range("A3").Value=$Preversion & $Version1 $oExcel.Range("C1").Value="Quantity" $oExcel.Range("C3").Value=$Count1 $oExcel.Range("E1").Value="Issue" $oExcel.Range("E3").Value=$CoverDate $oExcel.Range("G1").Value="Description" $oExcel.Range("G3").Value=$SF 5 Bucks via paypal to whoever can sucessfully provide me a solution first! Aim= Klufas15 MSN = Klufas15@hotmail.com Save your money and learn to use the Excel.au3 UDF: #include <Excel.au3> Global $sXLS = "C:\StartingPoint.xls" Global $oExcel = _ExcelBookOpen($sXLS) _ExcelSheetActivate($oExcel, "sheet1") _ExcelWriteCell($oExcel, "File Name", "A1") _ExcelWriteCell($oExcel, $Preversion & $Version1, "A3") _ExcelWriteCell($oExcel, "Quantity", "C1") _ExcelWriteCell($oExcel, $Count1, "C3") _ExcelWriteCell($oExcel, "Issue", "E1") _ExcelWriteCell($oExcel, $CoverDate, "E3") _ExcelWriteCell($oExcel, "Description", "G1") _ExcelWriteCell($oExcel, $SF, "G3") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ProgAndy Posted April 16, 2009 Share Posted April 16, 2009 Also, don't forget to close brackets *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Juvigy Posted April 17, 2009 Share Posted April 17, 2009 Who WON the 10 bugs from the prev. time? $oExcel = ObjCreate("Excel.Application") $oExcel.Application.Workbooks.Open("C:\test1a.xls") The above code works for me. If the file exists there should be NO error. Link to comment Share on other sites More sharing options...
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