This is my first really large Dot Net program and its giving me fits!
To try to simplify let me explain what it is supposed to do and then whats I believe is happening.
The program is supposed to take a number of drawings from a directory and make a collection of the filenames, open a new view drawing and place a certain number of these drawings in the new drawing until a specified area is filled, make a named view, then save and close the drawing, then open a new sheet drawing from a template, bring in the view drawing that was just created, create a paperspace viewport save and close. Then it would start the process over again beginning with the next filename from the collection (create view dwg, create sheet, create view dwg, create sheet) until all the files in the directory have been procesed.
So, I am doing this with with Sub_Routines and passing variables but it seems that as drawings are getting opened and closed my variables are, what seems to be randomly, getting reset to "nothing", I say randomly because sometimes the program will run and finish fine, but the next time I run it it errors out on the 2nd sheet (2nd run, 2nd sheet).
I think it might be how or where I have my variables declared or do my subs have to be "Shared" also to get the variables passing 100%?
Please give me some advice on what to do to solve this issue. I have attached the code.