nathan.anderson@numet.com Posted February 13, 2009 Posted February 13, 2009 I've created a VBA routine that loops based on a selection set of blocks from my active drawing to create a new drawing, insert several blocks and save the drawing. The routine works fine the first time through the loop, but on the second pass I get a "Run-time Error: -2145386445 (80200033) Filer Error". It's getting caught up on the first insert block. When I remove the loop, I can run the routine over and over for the same selection from my active drawing without any problem, but if I make a different selection to run the routine for, I get the error. I can get it to work for the second selection by changing the block that I insert. When I switch back to the first selection, the same error occurs until I change the block again. Set docObj = ThisDrawing.Application.Documents.Add("S:\Templates Active\acad electrical.dwt") file = "c:\Cable Project\cable - " & k ThisDrawing.SaveAs (file) insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0# Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, border, 1, 1, 1, 0) any ideas, and any help is appreciated. Thanks, Nathan Quote
CmdrDuh Posted February 13, 2009 Posted February 13, 2009 I had problems similiar, and had to set variables for all my files, I couldn't just pass a path Quote
nathan.anderson@numet.com Posted February 13, 2009 Author Posted February 13, 2009 doesn't seem to matter whether its a variable or a path, it never makes it past the first insert block. Quote
JohnM Posted February 13, 2009 Posted February 13, 2009 I don’t do a lot of VBA. I like lisp or vlisp. I have had situations similar to this before. In lisp and correct me if I’m wrong, but the lisp or vba program is loaded into the active drawing not the overall AutoCAD environment. Therefore your program is loaded into the first drawing and executes the code to make a new drawing which becomes the active document which has no code loaded into it taking focus off the first drawing and causing the code to stop. In the past if I want to interact between two drawings I has to utilize a script. In the code I compiled all the info I needed and formatted it to write to a text file with a scr extension. Then have it write the file. Then the last thing in the code was a call to execute the script file. Quote
Recommended Posts
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.