Display full version of the post: Reporting using MS Word(VBA)

GaryM
03.09.2007, 09:51
Heya
 
Created a report via VBA looking at the active drawings LayerOn property. If its true it should populate the Columns and rows created via vba with only the data of the layer where their LayerOn = True. Its working fine, but its putting all the data into the report hiding the layers thats off. So instead of giving for example two pages of data, it gives me 4 pages with 2 pages of printable data.
 
The code is as follows;
 
Dim objLayer As AcadLayer'only put unknown layer data in table  For Each objLayer In Application.Documents cboDrawingName.Text).Layers   If objLayer.LayerOn = True Then      With mobjTable        .Cell(lngRow, lngColumn).Range.Text = objLayer.Name          lngColumn = lngColumn + 1        .Cell(lngRow, lngColumn).Range.Text = ConvertToWord(objLayer.LayerOn)          lngColumn = lngColumn + 1        .Cell(lngRow, lngColumn).Range.Text = ConvertToWord(objLayer.Freeze)          lngColumn = lngColumn + 1        .Cell(lngRow, lngColumn).Range.Text = ConvertToWord(objLayer.Lock)          lngColumn = lngColumn + 1'increment the row counter          lngRow = lngRow + 1'column counter must begin at 1          lngColumn = 1      End With    End If  Next objLayer
 
Is there a way i can only populate the table with layer data i need?