Jump to content

Excel 2003 reaad and write


 Share

Recommended Posts

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 ;)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...