Help,
I am trying to work through the CP15-1 tutorial to get a handle on managing sheet sets using VBA. I am using Autocad 2006. I have copied the code for Adding Content to the Sheet Set File. I have tried to write a little sub procedure to launch the code from the click event of a button but I cannot seem to get the call statement right. I keep getting compile errors "missing list seperator or )" I even followed the little box that pops up to show you the syntax, I'm lost here. Here is the code I am trying to use:
Code:
Sub CreateSubset_Click()
CreateSubset(oSheetdb1 As AcSmDatabase, strName1 As String, strDesc1 As String, [strNewSheetLocation1 As String= ""], [strNewSheetDWTLocation1 As String = ""], [strNewSheetDWTLayout1 As String = ""], [bPromptForDWT1 As Boolean = False]) As AcSmSubset
End Sub
Private Function CreateSubset(oSheetDb As AcSmDatabase, _
strName As String, _
strDesc As String, _
Optional strNewSheetLocation As String = "", _
Optional strNewSheetDWTLocation As String = "", _
Optional strNewSheetDWTLayout As String = "", _
Optional bPromptForDWT As Boolean = False) As AcSmSubset
'' Create a Subset with the provided name and description
Set CreateSubset = oSheetDb.GetSheetSet().CreateSubset(strName, strDesc)
'' Get the Folder the Sheet Set is Stored in
Dim strSheetSetFldr As String
strSheetSetFldr = Mid(oSheetDb.GetFileName, 1, InStrRev(oSheetDb.GetFileName, "\"))
'' Create a reference to a File Reference object
Dim oFileRef As IAcSmFileReference
Set oFileRef = CreateSubset.GetNewSheetLocation
'' Check to see if a path was provided, if not default to the Sheet Set location
If strNewSheetLocation <> "" Then
oFileRef.SetFileName strNewSheetLocation
Else
oFileRef.SetFileName strSheetSetFldr
End If
'' Set the new sheet location for the Subset
CreateSubset.SetNewSheetLocation oFileRef
'
' Create a reference to a Layout Reference object
Dim oLayoutRef As AcSmAcDbLayoutReference
Set oLayoutRef = CreateSubset.GetDefDwtLayout
'' Check to see that a default DWT Location was passed in
If strNewSheetDWTLocation <> "" Then
'' Set the location of the template in the Layout Reference object
oLayoutRef.SetFileName strNewSheetDWTLocation
'' Set the Layout name for the Layout Reference object
oLayoutRef.SetName strNewSheetDWTLayout
'' Set the Layout Reference to the Subset
CreateSubset.SetDefDwtLayout oLayoutRef
End If
'' Set the Prompt for Template option of the Subset when a new Sheet is created
CreateSubset.SetPromptForDwt bPromptForDWT
End Function
Can someone point me in the right direction? I cannot procede until I can get past this point.
Bud