Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How in VBA in AutoCAD to set the paper size?

Status
Not open for further replies.

rokoko7

Programmer
Mar 28, 2011
2
PL
Hi,

In what way using VBA to set the paper size (for example: A2, A3, A4) and color (for example: black)?

please help
 
Hi rokoko7,

Here's what you need:

Code:
Sub Example_GetCanonicalMediaNames()
    ' This example gets the current plot device information
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout
    
    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo
    
    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()
    
    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next
    
    ' List all the media names, and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()
    
    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next
    
    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()
    
    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next
    
End Sub

HTH
 
Thank you, but how to set the paper size for example: A5 ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top