Hello everyone,
I'm working with AutoCAD VBA and I’m encountering an issue that I can't quite figure out. Here's the situation:
Has anyone experienced a similar issue where AutoCAD automatically adds an extra viewport when creating a new layout via VBA? If so, how can I delete the extra viewport or prevent it from being created in the first place?
Any help or guidance would be greatly appreciated!
Thanks in advance!
If you open "Options" dialog box in AutoCAD, go to tab "Display", at the lower-left corner, you can see an checkbox "Create viewport in new layout". If it is checked, AutoCAD will create a viewport when a new layout is added.
You can use code to change this option via Application.Preferences.Display.LayoutCreateViewport by setting its value to False/True.
However, it might be good practice to let your code to always examine the layout for existing viewports and do something accordingly, such as erasing, or modifying as needed.
There is no reason that existing viewport cannot be deleted from code, unless the code is wrong. Since you did not show your code, I can only say that your code does not delete the layout correctly.
Can't find what you're looking for? Ask the community or share your knowledge.