Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi @mostafamahmoudseddek94.  I don't know if the code in your last post is working for you yet, but I'm betting not.  When quickly looking it over this morning I saw something that is most likely a problem/mistake.  Within your 'AddBalloon' sub routine, at the point you are attempting to get the DrawingView object, you are declaring your oView variable, and setting its value, all within both a For...Next block, and within a If...Then block.  In order to retain that variable and its value, you must at least declare the variable before, and outside of those two blocks of code.  It's OK to set its value within those blocks though.  When you declare a variable within a lower level block of code, it only exists within that lower level block of code, and does not exist at the higher level block of code.  So, the following block of code that is checking 'If oView is Nothing' will likely always be True, until you fix that.  Also, I noticed that you created a new variable called 'sViewName' just before this point.  That is totally unnecessary.  You could just delete that, then in the message following the 'oView Is Nothing' check, replace 'sViewName' variable with the original 'viewName' variable.  Just a couple quick thoughts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)