rbhogavalli
11 years agoOccasional Contributor
not able to access methods and objects after capturing the cellrange for the sheet
Code:
Dim ColName(), new_nodes()
Dim Nodes() 'Array storing the current splited node names
Dim NodeStack() 'Array storing the last node names
' the default node delimiter
Const Node_Sep = "/"
'Open Excel Connection
Set Excel = Sys.OleObject("Excel.Application")
Excel.Workbooks.Open("Z:\Automation\Auto Programs, Code base & Internal Tools\Auto tools\Generate_XML.xlsm")
Delay 1000
Excel.Worksheets("UPS").Activate
' Discover dimensions of the data we will be dealing with...
ColCount = Excel.ActiveSheet.UsedRange.Columns.Count
ReDim ColName(ColCount) ' The Array of column names
RowCount = Excel.ActiveSheet.UsedRange.Rows.Count
If RowCount >= 1 Then
' Loop accross columns... and put names in array
For i = 1 To ColCount
' Mark the cell under current scrutiny by setting an object variable...
Set rngCell = Excel.ActiveSheet.Cells(1,i)
ColName(i) = rngCell.Text
Next
End If
.............................etc
I am not able to access methods when i type rngCell. but when i type in rngCell.Text just hoping that it will support, it works. So IDE is not showing me the supported methods, objects or constructers if at all they have.
Is there anything i missed setting up :(.
Dim ColName(), new_nodes()
Dim Nodes() 'Array storing the current splited node names
Dim NodeStack() 'Array storing the last node names
' the default node delimiter
Const Node_Sep = "/"
'Open Excel Connection
Set Excel = Sys.OleObject("Excel.Application")
Excel.Workbooks.Open("Z:\Automation\Auto Programs, Code base & Internal Tools\Auto tools\Generate_XML.xlsm")
Delay 1000
Excel.Worksheets("UPS").Activate
' Discover dimensions of the data we will be dealing with...
ColCount = Excel.ActiveSheet.UsedRange.Columns.Count
ReDim ColName(ColCount) ' The Array of column names
RowCount = Excel.ActiveSheet.UsedRange.Rows.Count
If RowCount >= 1 Then
' Loop accross columns... and put names in array
For i = 1 To ColCount
' Mark the cell under current scrutiny by setting an object variable...
Set rngCell = Excel.ActiveSheet.Cells(1,i)
ColName(i) = rngCell.Text
Next
End If
.............................etc
I am not able to access methods when i type rngCell. but when i type in rngCell.Text just hoping that it will support, it works. So IDE is not showing me the supported methods, objects or constructers if at all they have.
Is there anything i missed setting up :(.
- Hi Reshma,
You are accessing an Excel COM object. TestComplete won't show its properties or methods in Code Completion. To learn the property you can call, you need to refer to the MSDN documentation. Here is the description of the Range object which the Cells property returns.