Originally Posted by
Ed Jobe
Have you set/created oSheetDb?
Yes, I have. Below is the complete function in which the offending piece of code occurs:
Code:
'Setup the Sheet Set Defaults
Private Sub SetSheetSetDefaults(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)
'Set the Name and Description for the Sheet Set
oSheetDb.GetSheetSet().SetName strName
oSheetDb.GetSheetSet().SetDesc strDesc
'Check to see if a Storage Location was provided
If strNewSheetLocation <> "" Then
'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 = oSheetDb.GetSheetSet().GetNewSheetLocation
'Set the default storage location based on the Sheet Sets location
oFileRef.SetFileName strSheetSetFldr
'Set the new Sheet location for the Sheet Set
oSheetDb.GetSheetSet().SetNewSheetLocation oFileRef
End If
'Set override template location.
'Create a reference to a File Reference object
Dim TempRef As IAcSmFileReference
Set TempRef = oSheetDb.GetSheetSet().GetAltPageSetups()
TempRef.SetFileName cstrOvrTemplate
'Set the default template location
oSheetDb.GetSheetSet().SetAltPageSetups TempRef
'Check to see if a Template was provided
If strNewSheetDWTLocation <> "" Then
'Add Default Template to Sheet Set
Dim oLayoutRef As AcSmAcDbLayoutReference
Set oLayoutRef = oSheetDb.GetSheetSet().GetDefDwtLayout
'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
oSheetDb.GetSheetSet().SetDefDwtLayout oLayoutRef
End If
'Set the Prompt for Template option of the Subset when a new Sheet is created
oSheetDb.GetSheetSet().SetPromptForDwt bPromptForDWT
End Sub
When I get to debug mode, it's the "TempRef.SetFileName" line that is highlighted so I'm assuming it has something to do with my "Set TempRef" code.