Sign in to follow this  
Followers 0
nicky40

Excel help!

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0