View Full Version : Set plot paper size

2004-11-16, 07:57 PM
Hi all,

I'm a little stuck and confused :confused: on this one. I am needing to set the paper size for a plot, but I don't udnerstand how to do this in VBA. For example, I have a PC3 file with "Oversized: Custom 1: 42 x 30 in." listed on the plot dialog, but I don't know how to set it in my code :confused: .

I tried this:

ThisDrawing.ActiveLayout.CanonicalMediaName = "Oversized: Custom 1: 42 x 30 in."

But that just gave me an error :banghead: . And when I checked this:


It gave me a very long list of names, and none of them matched the one in my plot dialog. :screwy:

I would REALLY appreciate if someone could enlighten me as to how to go about this properly.

2004-11-22, 08:22 PM
For anyone interested, I have found the solution I was looking for. Here it is:

Private Function setMedia(size As String)
Dim mediaNames As Variant
Dim x As Integer
mediaNames = ThisDrawing.ActiveLayout.GetCanonicalMediaNames
For x = LBound(mediaNames) To UBound(mediaNames)
If StrComp(ThisDrawing.ActiveLayout.GetLocaleMediaName(mediaNames(x)), size, vbTextCompare) = 0 Then
ThisDrawing.ActiveLayout.CanonicalMediaName = mediaNames(x)
End If
End Function

I set my plot device then run this function supplying the name of the paper size to use.