Code:-
strFilePath = "C:\UFT_Folder\UserData.xlsx"
Set Excel_Obj = CreateObject("Excel.Application")
Set objworkbook = Excel_Obj.Workbooks.Open(strFilePath)
Set objworksheet = objworkbook.Worksheets("Sheet1")
msgbox objworksheet.usedrange.rows.count
msgbox objworksheet.usedrange.columns.count
msgbox objworksheet.usedrange.Address
Set objworksheet = nothing
Set objworkbook = nothing
Excel_Obj.Quit
Set Excel_Obj = nothing
' The First message box will give you used Rows Count
' The First message box will give you used columns Count
' The First message box will give you address of the last cell used like $F$8:$G$10
strFilePath = "C:\UFT_Folder\UserData.xlsx"
Set Excel_Obj = CreateObject("Excel.Application")
Set objworkbook = Excel_Obj.Workbooks.Open(strFilePath)
Set objworksheet = objworkbook.Worksheets("Sheet1")
msgbox objworksheet.usedrange.rows.count
msgbox objworksheet.usedrange.columns.count
msgbox objworksheet.usedrange.Address
Set objworksheet = nothing
Set objworkbook = nothing
Excel_Obj.Quit
Set Excel_Obj = nothing
' The First message box will give you used Rows Count
' The First message box will give you used columns Count
' The First message box will give you address of the last cell used like $F$8:$G$10
No comments:
Post a Comment
Note: only a member of this blog may post a comment.