Public Sub PaperToTabloid()
'Dim FrmSetup_InfoFlex As ArcMapUI.IMxDocument
Dim pMxDoc As IMxDocument
Dim pMxApp As IMxApplication
Dim pPrinter As IPrinter
Dim pPaper As IPaper
Dim iFormId As Long
Dim dPaperWidth As Double, dPaperHeight As Double
Dim sFormName As String
Dim pEnumTypeInfo As IEnumNamedID
Dim sTargetForm As String
Set pMxDoc = ThisDocument
Set pMxApp = ThisDocument.Parent
Set pPrinter = pMxApp.Printer
Set pPaper = pPrinter.Paper
' do a non-case-sensitive search for "11 x 17" in the paper sizes
' reported by the printer.
sTargetForm = "11 x 17"
Set pEnumTypeInfo = pPaper.Forms
pEnumTypeInfo.Reset
iFormId = pEnumTypeInfo.Next(sFormName)
Do While (InStr(1, sFormName, sTargetForm, vbTextCompare) < 1) And (iFormId > 0)
Debug.Print "FormID:" & iFormId & vbTab & "FormName:" & sFormName
iFormId = pEnumTypeInfo.Next(sFormName)
DoEvents
Loop
Debug.Print "*** searched for '" & sTargetForm & "'... found:";
Debug.Print " FormID:" & iFormId & vbTab & "FormName:" & sFormName
' exit the subroutine if the target form was not found on the current printer
If iFormId = 0 Then Exit Sub
' if target form was found, assign it's form id to the Paper object
pPaper.FormID = iFormId
' set the page size to match the new paper size
pPaper.QueryPaperSize dPaperWidth, dPaperHeight
pMxDoc.PageLayout.Page.PutCustomSize dPaperWidth, dPaperHeight
' turn Same As Printer on
pMxDoc.PageLayout.Page.FormID = esriPageFormSameAsPrinter
pMxDoc.ActiveView.PrinterChanged pMxApp.Printer
End Sub
Agradecendo desde já!