Hello,
I have been working for some engineering firm to update their in-house VBA tools to the demands of the modern days. Most of the changes I have implemented work now, but since I am relatively new at programming VBA I'd like to know if my choices were sensible. I think my boss will frown upon fully divulging all the code I have written (and functions have Dutch names and Dutch comments, so they wouldn't be of much use to you anyway), but the global set-up may prove interesting, or completely wrong, but that is up to you to decide.
The old version of the in-house tool just applied borders and scaling to modelspace. In the days of R14 that may have been the way to do things, but nowadays that is what layouts are for.
The first thing i did was programming a menu that offered a limited choice in paper sizes, scales, and border styles, which are all read out of a config file. It set up a pviewport that fits into the border, even if the engineer decides not to use borders for a layout it is still a pretty nice way to define margins. The paper is set up with a custom pc3 file that we can redistribute with our customized installer, that is chosen because it was speedy. The paper sizes for that driver are without margins, since they are a pain to set up.
For printing there was a custom routine in place as well (mostly because older versions of autocad didn't offer lineweight scaling and because they have a nifty extension that helps with multi-file-plotting. They requested that I left it there, so I did. On initializing of the printerform it checks if the active layout has a papersize that is compatible with one of the configured printers. Before printing the layoutsettings are saved, because all the settings may be changed when printing to "fit". They are restored on exiting the dialogue. This is all nice, and working pretty nicely, apart from the fact that restoration only works if I don't exit the dialogue too fast, or else I get stuch with the printer settings that are installed on my system instead of those from my carefully pampered PC3 file.
Do you guys know of any way to detect that the plotter has done it's job, and use that to trigger a RestoreLayout routine? Also feel free to point out any bad ideas now, so I can avoid them in the future.