Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So, I'm trying to use this code in order to create a page setup in a drawing:
Function PageSetup() Dim sSetupName As String Dim oPlotConfig As AcadPlotConfiguration 'Add new plot configuration sSetupName = "My_New_Setup" Set oPlotConfig = ThisDrawing.PlotConfigurations.Add(sSetupName) 'Setup desired plot parameters oPlotConfig.PaperUnits = acMillimeters oPlotConfig.PlotType = acExtents oPlotConfig.PlotRotation = ac90degrees 'Copy the new plot config parameters into the active layout Call ThisDrawing.ActiveLayout.CopyFrom(ThisDrawing.PlotConfigurations(sSetupName)) 'Call ThisDrawing.ActiveLayout.CopyFrom(ThisDrawing.PlotConfigurations(oPlotConfig.Name)) 'Call ThisDrawing.ActiveLayout.CopyFrom(oPlotConfig) End Function
When I run this code, I get the following error:
Run-time error '2145386464 (80200020)' Invalid object type
As you can see, from the last four lines of the code, I've tried various combinations of the same thing, however all of these produces the same errror.
Can anyone suggest where the issue lies please?
Solved! Go to Solution.