Active Contributor
38 Posts
1 Kudo
Registered: ‎10-16-2012
Post 1 of 2

AcSmComponents17 1.0 library missing/Code Help

136 Views, 1 Replies
02-08-2013 12:53 PM

I'm not a programmer so my question may seem obvious. I'm trying to run this code and it gives me a library missing error. I changed the reference from 17 to the AcSmComponents18 library. Now it gives me a runtime error "can't create object."  [at the Set sheetSetMgr = New AcSmSheetSetMgr line]


Does anyone know how I can get this code to run in ACAD 2010...thx



' Written by Lee Ambrosius ' Date: 3/24/04

' Program is provided AS-IS with no expressed written warranty

' This example demonstrates a couple of the new SheetSet API and some of its

' many properties and methods


Option Explicit

Dim sheetSetMgr As IAcSmSheetSetMgr

Dim sheetdb As IAcSmDatabase


' Lets count up Sheets and iterate through all open SheetSets

Public Sub SetSheetCount()  

Dim sheetCount As Integer  

Dim iterDb As IAcSmEnumDatabase  

Dim ItemDb As IAcSmPersist    


Set sheetSetMgr = New AcSmSheetSetMgr    

Set iterDb = sheetSetMgr.GetDatabaseEnumerator  

Set ItemDb = iterDb.Next      

Do While Not ItemDb Is Nothing    

Set sheetdb = ItemDb      

' Lock Database    



On Error Resume Next        


Dim sheet As IAcSmSheet    

Dim iter As IAcSmEnumPersist    

Dim Item As IAcSmPersist          

Set iter = sheetdb.GetEnumerator    

Set Item = iter.Next        

Do While Not Item Is Nothing      

Set sheet = Item              

If Item.GetTypeName = "AcSmSheet" Then        

sheetCount = sheetCount + 1      

End If          

Set Item = iter.Next    


' Apply the Sheet Count as a custom property    

Dim cBag As IAcSmCustomPropertyBag    

Dim cBagVal As New AcSmCustomPropertyValue      

Set cBag = sheetdb.GetSheetSet().GetCustomPropertyBag      

cBagVal.InitNew cBag

    cBagVal.SetFlags CUSTOM_SHEETSET_PROP    

cBagVal.SetValue CStr(sheetCount)      

cBag.SetProperty "Total Sheets", cBagVal        

Set cBagVal = Nothing        


' Unlock the database    



' Clear and check for next SheetSet that is open    

sheetCount = 0    

Set ItemDb = iterDb.Next  


End Sub


' Used to Lock the database back up (SheetSet)

Private Sub LockDatabase()    

On Error Resume Next        

Dim lockStatus As AcSmLockStatus    

Let lockStatus = sheetdb.GetLockStatus

    If lockStatus = AcSmLockStatus_UnLocked Then      

sheetdb.LockDb sheetdb    

End If

End Sub


' Used to Unlock the database back up (SheetSet)

Private Sub UnlockDatabase()    

On Error Resume Next        

Dim lockStatus As AcSmLockStatus    

If lockStatus = AcSmLockStatus_Locked_Local Or AcSmLockStatus_Locked_Remote Then      

sheetdb.UnlockDb sheetdb    

End If

End Sub

*Expert Elite*
1,088 Posts
217 Kudos
Registered: ‎04-27-2009
Post 2 of 2

Re: AcSmComponents17 1.0 library missing/Code Help

02-08-2013 02:49 PM in reply to: kylei7449

Is your code VBA code or VB.NET API code (since you post in .NET forum)? To me, it looks suspiciously like VBA code.


Also, you mentioned you use AutoCAD 2010, but did not mention it is 32-bit or 64-bit version. If the code is VBA code, 32/64-bit really matters.


That is, if the code is VBA code and you are using 64-bit AutoCAD, the code simply does not work and no way to fix. You need to find other workaround (i.e. use .NET API DLL in conjunction with 64-bit Sheet Manager COM interop).

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!