motormad Posted October 30, 2010 Share Posted October 30, 2010 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 More sharing options...
BugFix Posted October 30, 2010 Share Posted October 30, 2010 ConsoleWrite('Count rows: ' & $oExcel.Worksheets(1).UsedRange.Rows.Count & @CRLF) Best Regards BugFix Link to comment Share on other sites More sharing options...
hot202 Posted October 30, 2010 Share Posted October 30, 2010 Why not use _ExcelReadCell ? Link to comment Share on other sites More sharing options...
motormad Posted October 30, 2010 Author Share Posted October 30, 2010 thanx BugFix Icon thats it. Hot202 i wil try it out 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