AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Use of the AEC Layer Setting functions

0 REPLIES 0
Reply
Message 1 of 1
mike
431 Views, 0 Replies

Use of the AEC Layer Setting functions

I am getting an "Active X can't create Object" error with this code.  It is VBA with ACA2013.  I have the enabler installed.  I am building a routine that will ultimately be in VB.net but I can't get off the starting block.

References:

AECXUiArchBase

AECXArchBase

AECXUiBase

AECXBase

AutoCad2013 Type Library

Visual Basic for Applications

OLE automation

 

My code (with the line with the error marked.:

 

Public Sub CreateLayers()

Dim oDoc As AecArchBaseDocument
Dim o_dbPref As AecArchBaseDatabasePreferences
Dim cLayerKeyStyles As AecLayerKeyStyles
Dim oLayerKeyStyle As AecLayerKeyStyle
Dim cLayerKeys As AecLayerKeys
Dim oLayerKey As AecLayerKey
Dim oLayer As AcadLayer

'Activate the AEC Document using the AecArchBaseApplication
Set oDoc = AecArchBaseApplication.ActiveDocument '------>>>ActiveX Can't create Object<<<<<<----------
'Activate the AEC Preferences Collection
Set oPref = oDoc.Preferences
'Activate the LayerKeyStyles collection
Set cLayerKeyStyles = oDoc.LayerKeyStyles
'Sets the layer key style to the current layer standard
Set oLayerKeyStyle = cLayerKeyStyles.Item(oPref.LayerStandard)
'Message for verification
MsgBox "The current Layer Key Style is: " & o_dbPref.LayerStandard, _
vbInformation, "Current Layer Key Style"
'Activate the Keys collection of the current layer standard
Set cLayerKeys = oLayerKeyStyle.Keys
'Message for varification
MsgBox "The current number of layer keys is: " & o_cLayerKeys.Count, _
vbInformation, "Current Layer Key Count"

'Clean up all your declared objects
Set oLayer = Nothing
Set cLayerKeys = Nothing
Set oLayerKeyStyle = Nothing
Set cLayerKeyStyles = Nothing
Set oPref = Nothing
Set oDoc = Nothing
End Sub

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost