Print Page | Close Window

Reporting using MS Word(VBA)

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=84
Printed Date: 22.Apr.2026 at 23:00


Topic: Reporting using MS Word(VBA)
Posted By: GaryM
Subject: Reporting using MS Word(VBA)
Date Posted: 03.Sep.2007 at 09:51
HeyaBig%20smile
 
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?


-------------
Regards,
Gary Mansfield



Print Page | Close Window