This example is hard coded to make sheet 1 = B size. Tested fine here using my default template.
Adding radio buttons to select a different size should be trivial from this point as long as the sizes you need are on the DrawingSheetSizeEnum list.
Sheet formats would be another way to do this-- it could even be the better choice if you need to use size-specific title blocks or portrait/landscape options.
Code:
Public Sub SaveAsDrawing()
'written by Sean Dotson with a little change by Kevin Schneider, copyright 2006
'declare the environment
Dim oApp As Application
Dim oCurrentDoc As Document
Dim oNewDoc As Document
Dim UseDefaultTemplate As Boolean
Dim oNewDwg As DrawingDocument
Set oApp = ThisApplication
Set oCurrentDoc = oApp.ActiveDocument
On Error GoTo ErrorSub
Select Case oApp.ActiveDocumentType
Case kAssemblyDocumentObject, kPartDocumentObject
sCurrentFilename = ThisApplication.ActiveDocument.FullFileName
If sCurrentFilename = "" Then
MsgBox "The active file must first be saved"
Exit Sub
End If
'if you want to use the default template then set UseDefaultTemplate = True
'if you want to use a custom template set the path and filename of sTemplatePart and UseDefaultTemaplte = False
UseDefaultTemplate = False
Dim sTemplateDrawing As String
If Units = "Metric" Then
sTemplateDrawing = "K:\Inventor Synced\R2012 Templates\_RND\Metric Detail.idw"
ElseIf Units = "Imperial" Then
sTemplateDrawing = "K:\Inventor Synced\R2012 Templates\_RND\Std Detail.idw"
End If
Select Case UseDefaultTemplate
Case True
Set oNewDoc = oApp.Documents.Add(kDrawingDocumentObject, oApp.FileManager.GetTemplateFile(kDrawingDocumentObject), True)
Case False
Set oNewDoc = oApp.Documents.Add(kDrawingDocumentObject, sTemplateDrawing, True)
End Select
' Public Enum DrawingSheetSizeEnum
' kCustomDrawingSheetSize = 9986
' kADrawingSheetSize = 9987
' kBDrawingSheetSize = 9988
' kCDrawingSheetSize = 9989
' kDDrawingSheetSize = 9990
' kEDrawingSheetSize = 9991
' kFDrawingSheetSize = 9992
' kA0DrawingSheetSize = 9993
' kA1DrawingSheetSize = 9994
' kA2DrawingSheetSize = 9995
' kA3DrawingSheetSize = 9996
' kA4DrawingSheetSize = 9997
' k9x12InDrawingSheetSize = 9998
' k12x18InDrawingSheetSize = 9999
' k18x24InDrawingSheetSize = 10000
' k24x36InDrawingSheetSize = 10001
' k36x48InDrawingSheetSize = 10002
' k30x42InDrawingSheetSize = 10003
'End Enum
'
oNewDoc.Sheets.Item(1).Size = kBDrawingSheetSize
'-----------------------------------
'
'[b]<--- NEED TO SET SHEET SIZE HERE --> [/b]
'
'--------------------------------------
'Post the filename to the private event queue.
Call ThisApplication.CommandManager.PostPrivateEvent(kFileNameEvent, sCurrentFilename)
'Start the derived part command.
Call oApp.CommandManager.StartCommand(kCreateDrawingViewCommand)
Case Else
ErrorSub:
MsgBox "You must first have a Part or Assembly document open"
End Select
End Sub