Jump to content

VBA CanonicalMediaName issues


TroutKing

Recommended Posts

Good afternoon

Can someone help me figure out my plot size? I can't seem to get it to work.

As you can see in the code below I've tried a few different things. I have a small program from a long time ago that will return values like "User ####". That program indicates the plot size for my particular plotter should be User 1283. (I have no clue where those values come from and regardless of which returned value that I choose my program still wont work). However, no matter what I've tried - I can't get this code to run past the CanonicalMediaLine.

 

Any possible help?

 

 

 
Option Explicit
Public Sub SetPageLayout()
'On Error GoTo GetErr
Dim pLayoutConfig As AcadLayout
Set pLayoutConfig = ThisDrawing.ActiveLayout
Dim PlotSize As String
PlotSize = "Oce D+ 24x36 (Landscape)" 'or "User 1283" or "Oce_D_+_24x36_(Landscape)"
   pLayoutConfig.RefreshPlotDeviceInfo
   pLayoutConfig.ShowPlotStyles = False
   pLayoutConfig.ConfigName = "MyPLotter"
   pLayoutConfig.StyleSheet = MyCTBFile"
   pLayoutConfig.CanonicalMediaName = PlotSize ' or "Oce_D_+_24x36_(Landscape)" or "User 1283" or "Oce D+ 24x36 (Landscape)"
   pLayoutConfig.PaperUnits = acInches
   pLayoutConfig.CenterPlot = True
   pLayoutConfig.PlotWithPlotStyles = True
   ThisDrawing.ActiveLayout.PlotRotation = ac90degrees
   pLayoutConfig.PlotType = acExtents
   pLayoutConfig.StandardScale = ac1_1
   pLayoutConfig.RefreshPlotDeviceInfo
'GetErr:
If Err.Number <> 0 Then MsgBox ("                NO IDEA WHAT HAPPENED THERE" & vbCr & "EITHER TRY AGAIN OR GO HOME AND HAVE A BEER")
MsgBox "            DONE"
'ThisDrawing.Save
Exit_Here:
End Sub

Link to comment
Share on other sites

Nevermind! I got it. I need to load all of the CanonicalMediaNames after I select my plotter and then the "UserXXXX" (with no spaces) works well!

 

Thanks for looking though....:)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...