Message 1 of 3
Table Selection
Not applicable
02-05-2012
01:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi to all.
I have a little problem with table selection in 4 differnt already opened drawings.
The scope is to populate the table with data that are contents in a txt file previously stored in an array SourceFileName(I).
The below code should select 4 drawings wich contain table, select the table and populate certain rows and columns.
Seems that the code work properly only for the first table and not for the 2nd (index 26 to 50), the 3rd (index 51 to 75) and 4th (76 ti 100).
The code is executed for all sections but the value are not transfer to the table.
Pls somebody could help me ??
For I = 0 To MyLineCount
Select Case I
Case 0 To 25
For Each Doc In ThisDrawing.Application.Documents
If Doc.Name = "INDICE.dwg" Then
Doc.Activate
Exit For
End If
Next
For Each Entity In ThisDrawing.ModelSpace
If Entity.EntityName = "AcDbTable" Then
Set Tabella1 = Entity
Exit For
End If
Next Entity
Tabella1.SetCellValue I + 7, 2, SourceFileName(I)
Tabella1.SetCellValue I + 7, 3, SourceFileName(I)
'
'
'
Case 26 To 50
For Each Doc In ThisDrawing.Application.Documents
If Doc.Name = "INDICE_2.dwg" Then
Doc.Activate
Exit For
End If
Next
For Each Entity2 In ThisDrawing.ModelSpace
If Entity2.EntityName = "AcDbTable" Then
Set Tabella2 = Entity2
Exit For
End If
Next Entity2
Tabella2.SetCellValue I + 2, 2, SourceFileName(I)
Tabella2.SetCellValue I + 2, 3, SourceFileName(I) '
'
'
Case 51 To 75
For Each Doc In ThisDrawing.Application.Documents
If Doc.Name = "INDICE_3.dwg" Then
Doc.Activate
Exit For
End If
Next
For Each Entity3 In ThisDrawing.ModelSpace
If Entity3.EntityName = "AcDbTable" Then
Set Tabella3 = Entity3
Exit For
End If
Next Entity3
Tabella3.SetCellValue I + 2, 2, SourceFileName(I)
Tabella3.SetCellValue I + 2, 3, SourceFileName(I)
'
'
'
If I = 76 Then
ThisDrawing.Application.Documents.Close
End If
Case 76 To 100
For Each Doc In ThisDrawing.Application.Documents
If Doc.Name = "INDICE_4.dwg" Then
Doc.Activate
Exit For
End If
Next
For Each Entity4 In ThisDrawing.ModelSpace
If Entity4.EntityName = "AcDbTable" Then
Set Tabella4 = Entity4
Exit For
End If
Next Entity4
Tabella1.SetCellValue I + 2, 2, SourceFileName(I)
Tabella1.SetCellValue I + 2, 3, SourceFileName(I)
'
'
End Select
Next
End Sub