Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
As a learning exercise I am trying to convert a old vba program to vb.net. I am experienced in vb.net and AutoCAD but not with programing Autocad. Hence the learning exercise.
One issue I am having is converting:
Private Sub cmdCreateLayerReport_Click()
'connect or instantiate microsoft word
Set mobjWord = CreateObject("Word.Application")
'make microsoft word visible
mobjWord.Visible = True
'create a new document in microsoft word
Set mobjDoc = mobjWord.Documents.Add
'set header and footer and page layout
With mobjDoc
' set page layout to landscape
.PageSetup.Orientation = wdOrientLandscape
'set header (drawing path and name)
.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "Layer Report for: " & Application.Documents(cboDrawingName.Value).Path & "\ " & Application.Documents(cboDrawingName.Value).Name
'set footer (date created and total layer count)
.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = "Date Created: " & Date & vbTab & "Total # of Layers: " & Application.Documents(cboDrawingName.Value).Layers.Count
'set page numbers
.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers.Add wdAlignPageNumberRight
End With
I have converted everything up to the point of:
.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = "Date Created: " & Date & vbTab & "Total # of Layers: " & Application.Documents(cboDrawingName.Value).Layers.Count
I cant figure out how to get the layer count to work. (I have adjusted the date)
Any help would be greatly appreciated. Please note that I am using Civil 3D 2016.
Solved! Go to Solution.