Sign in to follow this  
Followers 0
motormad

Excel 2003 reaad and write

4 posts in this topic

Hello,

I would like to make a script that reads from an excel file.

Set it in variable and puts them in an other program .

i got thsi

$FilePath="c:\Book1.xls"
If Not FileExists($FilePath) Or Not StringInStr($FilePath, "xls") Then
  $FilePath = FileOpenDialog("Go - Choose your excel file as inbuilt one not exists", $FilePath, "Worksheet" & " (" & "*.xls" & ")", 1);+ $Recurse+ $Recurse
EndIf
$MyObject = ObjGet($FilePath); Create an Excel Object
If @error Then
    MsgBox(0, "Excel Error:", "Error creating Excel object!")
    Exit
EndIf
If Not IsObj($MyObject) Then
    MsgBox(16, "Excel Error:", "Error creating Excel object!")
    Exit
EndIf
   $MyObject.Windows (1).Visible = 1; Set the first worksheet in the workbook visible
   $MyObject.Worksheets (1).Activate
   $MyObject.ActiveSheet.Visible = 1

   $MyObject.Application.Visible = 1

local  $A_CELL

With $MyObject.Sheets(1)
    $A_CELL= .Range("A1:A1").value
    .Range("A1:A2").value = "rrr"
endwith

 MsgBox(0,"title",$A_CELL)

It can open an excel and reads a cel A1:A1

And puts "rrr" in A1:A2

What i need to know is. How much rows are filled in sheet1 ?

Thanx ;)

Share this post


Link to post
Share on other sites



ConsoleWrite('Count rows: ' & $oExcel.Worksheets(1).UsedRange.Rows.Count & @CRLF)


Best Regards BugFix  

Share this post


Link to post
Share on other sites

Why not use _ExcelReadCell ?

Share this post


Link to post
Share on other sites

thanx BugFix Icon thats it.

Hot202 i wil try it out ;)

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