korhaniski Posted December 4, 2009 Share Posted December 4, 2009 Hello all, I am having an issue with a code that semi works. The following code works when i have only one block that is called "DBORDER_1" Dim blk As AcadBlockReference For Each blk In ThisDrawing.ModelSpace If blk.Name = "DBORDER_1" Then .... However when I have more than 1 block than the vba code crashes. The runtime error code is 13, type mismatch. What i am trying to do is to find the block named "DBORDER_1" and determine its attributes. would anyone know how to remove this problem. thanks. Korhaniski Quote Link to comment Share on other sites More sharing options...
fixo Posted December 4, 2009 Share Posted December 4, 2009 Hello all, I am having an issue with a code that semi works. The following code works when i have only one block that is called "DBORDER_1" Dim blk As AcadBlockReference For Each blk In ThisDrawing.ModelSpace If blk.Name = "DBORDER_1" Then .... However when I have more than 1 block than the vba code crashes. The runtime error code is 13, type mismatch. What i am trying to do is to find the block named "DBORDER_1" and determine its attributes. would anyone know how to remove this problem. thanks. Korhaniski At the first glance you need declare AcadEntity before i.e. Dim oEnt as AcadEntity Dim blk As AcadBlockReference For Each oEnt In ThisDrawing.ModelSpace if Typeof oEnt Is AcadBlockReference Then Set blk=oEnt If blk.Name = "DBORDER_1" Then < the rest code goes here> End If End If Next oEnt ~'J'~ Quote Link to comment Share on other sites More sharing options...
korhaniski Posted December 4, 2009 Author Share Posted December 4, 2009 Ahhh awesome thanks bunch i owe u cofee ~'J'~ Quote Link to comment Share on other sites More sharing options...
fixo Posted December 4, 2009 Share Posted December 4, 2009 Ahhh awesome thanks bunch i owe u cofee ~'J'~ You're quite welcome (Remember use AcadEntity in loops) ~'J'~ Quote Link to comment Share on other sites More sharing options...
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.