
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm pretty new to VBA and I'm trying to understand how arrays work so I that can use one in a macro for manipulating a Parts List.
My test code uses an array called AAARowList. When I try to assign a value to the first element, I get "Compile error: Invalid use of property". I'm sure that I'm overlooking something simple, but I've never used an array before, so I'm clueless. I haven't been able to find many examples of dynamic arrays used in a similar situation either. Here's my code:
Public Sub Test()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oPartList As PartsList
Set oPartList = oDrawDoc.SelectSet.Item(1)
Dim MyRow As PartsListRow
Dim rowIndex As Integer
Set MyRow = oPartList.PartsListRows.Item(rowIndex)
Dim AAARowList(0) As PartsListRow
Dim AAARowIndex As Integer
rowIndex = 0
AAARowIndex = 0
AAARowList(AAARowIndex) = MyRow
AAARowIndex = AAARowIndex + 1
ReDim Preserve AAARowList(AAARowIndex + 1)
End Sub
Eventually, the test code will be used in a bigger macro that cycles through the rows in a parts list. Any row that meets a certain criteria will be saved in the array so that action can be performed later on in the macro.
I appreciate any help!
Nate
Solved! Go to Solution.