Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How in VBA in AutoCAD to set the paper size?

How in VBA in AutoCAD to set the paper size?

How in VBA in AutoCAD to set the paper size?


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

please help

RE: How in VBA in AutoCAD to set the paper size?

Hi rokoko7,

Here's what you need:


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.
    ' 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)
    ' 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))
    ' 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)
End Sub


RE: How in VBA in AutoCAD to set the paper size?

Thank you, but how to set the paper size for example: A5 ?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close