Consistant VBA lockup

I am consistantly getting a lock up on a particular VBA statement. I am uncertain if I am doing something wrong, or if it is a bug.When I run the program, the BriscCad window comes up, and on top of that is a window titled "Server Busy". That window says "This action cannot be competed becuase the other program is busy..." The buttons to choose are "Swiitch to", "Retry", and a ghosted "Cancel".If I choose "switch to", the windows start button pops up. "retry" just does nothing.The only way out of this, is to cntl-alt-del and terminate the two BricsCad tasks that are running.Here is a summary of the code I have;sub getattributes()dim TempBlockText(10,10) As String Dim TempBlockSS As AcadSelectionSetDim objTempBlock As AcadBlockReferenceDim TempBlockAttributes As VariantDim strTemp As StringSet TempBlockSS = ThisDrawing.SelectionSets("adBlockSS")' the following successfully selects all the blocks' with attributes (some of the variables are ' already set for this)TempBlockSS.Select acSelectionSetAll, , , fType, fData Set objTempBlock = ThisDrawing.SelectionSets.Add("SS01")' the following line is the one that created ' the error. It should set the first element' of my array to be the object ID (in text format) TempBlockText(0, 0) = Format(objTempBlock.ObjectID) end subWhat is going on? If it is a bug, can you suggest a work-around.Joe Dunfee

Comments

  • Joe, I understand TempBlockSS holds a collection of Block references. After creating that selection set you will need to iterate through the objects in that selection set: For Each tmpObject in TempBlockSS Set aBlockReference= tmpObject TempBlockText(0, 0) = Format(aBlockReference.ObjectID) Next I don't understand why you create a second selection set SS01?Set objTempBlock = ThisDrawing.SelectionSets.Add("SS01")

  • Ferdinand, thank you very much for looking at my code.Yes, you caught an error. But, even after removing that duplicate selection set issue, the program would lock up at the same point.But, with more confidence that the ObjectID wasn't triggering a bug, I continued to work on it. It turned out that the Count variable I had in the statement was not a declaired variable. It should have read "CountA". Correcting this caused it to run correctly.It still should not have locked up. Rather, when it checked for declaired variables before it ran, reported that this variable wasn't declaired. I think this is a bug in VBA, rather than in BricsCad itself.This discussion does remind me of another thread. Since I had a suspicion that the ObjectID was triggering a BriscCad bug, I spent a lot of time trying to find a way around it. If I could have a list of known bugs, I would have had more confidence in BriscCAD, and shifted more of my efforts onto figguring out why my own code was wrong.I am sure this logic is the opposite of what any software company's marketing dept would say. But I think that if the bug list is kept secret, it is easier to assume a problem is one of the things on this secret list. Joe Dunfee

This discussion has been closed.