Monday, July 8, 2013

VBA InsertBlock Filer error and solution

Having VBA code like this can cause troubles.

Set objBlock = ThisDrawing.ModelSpace.InsertBlock(Point, "C:\demo.dwg", 1, 1, 1, 0)

With this error: Error description: “Filer error”   Error number: -2145386445

For some reason it is inconsequent because sometimes I found it working and sometimes it doesn’t. I first thought it had to do with the case of the file name did not match. I tried "C:\DEMO.DWG" and suddenly it worked but then again it didn’t. Not sure but it seems to work fine the first time AutoCAD is launched and after that it just don’t work longer.

I have only tested this in AutoCAD 2014 64-bit and Windows 8 so it might work differently with other setups but after I run into this I found that other have had similar problems in older AutoCAD versions too.

The workaround is to use a variable for the block name.

blockName="C:\demo.dwg"
Set objBlock = ThisDrawing.ModelSpace.InsertBlock(Point, blockName, 1, 1, 1, 0)


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner