Results 1 to 7 of 7

Thread: Page Setup Override in Sheet Set

  1. #1
    100 Club mcoffman's Avatar
    Join Date
    2005-08
    Location
    Porland, OR
    Posts
    128
    Login to Give a bone
    0

    Default Page Setup Override in Sheet Set

    Does anyone know how to set the page setup override template in a sheetset via vba?

    Thanks!
    MC

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Page Setup Override in Sheet Set

    Use the SetAltPageSetups method.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    100 Club mcoffman's Avatar
    Join Date
    2005-08
    Location
    Porland, OR
    Posts
    128
    Login to Give a bone
    0

    Default Re: Page Setup Override in Sheet Set

    Thanks Robert!

    I tried this bit of code after your advice and I keep getting a "Object Block or With Block not set" error. Any ideas?

    Code:
        
        '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
    Thanks!
    Michael

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: Page Setup Override in Sheet Set

    Have you set/created oSheetDb?
    C:> ED WORKING....


    LinkedIn

  5. #5
    100 Club mcoffman's Avatar
    Join Date
    2005-08
    Location
    Porland, OR
    Posts
    128
    Login to Give a bone
    0

    Default Re: Page Setup Override in Sheet Set

    Quote Originally Posted by Ed Jobe View Post
    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.

  6. #6
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Page Setup Override in Sheet Set

    Quote Originally Posted by mcoffman View Post
    Yes, I have. Below is the complete function in which the offending piece of code occurs:
    ...
    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.
    cstrOvrTemplate is not bound. You are writing code with Option Explict, aren't you? If you are, when you attempted to compile you would get an error because cstrOvrTemplate was not declared.
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  7. #7
    100 Club mcoffman's Avatar
    Join Date
    2005-08
    Location
    Porland, OR
    Posts
    128
    Login to Give a bone
    0

    Default Re: Page Setup Override in Sheet Set

    Quote Originally Posted by RobertB View Post
    cstrOvrTemplate is not bound. You are writing code with Option Explict, aren't you? If you are, when you attempted to compile you would get an error because cstrOvrTemplate was not declared.
    Sorry, I should have clarified that. cstrOvrTemplate is a constant and dimensioned in the General Declarations area of the code. Yes, I code with Option Explicit.

    MC

Similar Threads

  1. Sheet Set Manager - Page Setup Override Woes
    By cecilia.224441 in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2011-08-01, 11:25 PM
  2. Page setup override
    By matthew.221135 in forum AutoCAD General
    Replies: 5
    Last Post: 2009-08-14, 01:30 AM
  3. Single sheet publishing thru page setup override
    By aleksandarm in forum AutoCAD Sheet Set Manager
    Replies: 3
    Last Post: 2007-06-09, 11:42 PM
  4. Page Setup Override Does Not Show Up
    By martyk in forum AutoCAD General
    Replies: 6
    Last Post: 2006-03-06, 10:08 PM
  5. Missing Page Setups in Page Setup Override
    By footprint_arch in forum AutoCAD Sheet Set Manager
    Replies: 2
    Last Post: 2005-06-15, 08:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •