TransientElement Error

could any one can help me with below error in VBA?

code:

Sub ShowTransientElementsold()
    Dim tec1 As TransientElementContainer
    Dim ele1 As Element
    Dim flags As MsdTransientFlags
    Dim eleEnum As ElementEnumerator
    Set eleEnum = ActiveModelReference.GraphicalElementCache.Scan
    Set tec1 = CreateTransientElementContainer1(Nothing, flags, msdView1 + msdView4, msdDrawingModeHilite)
   
    Do While eleEnum.MoveNext
    Set ele1 = eleEnum.Current
    tec1.AppendCopyOfElement ele1
    Loop
 
End Sub

 

error image :

 

 

i'm using V8i select series 2

 

regards,

vinoth

 

regards,

vinoth

Parents
  • I don't know what's going on.  I copied your code into a MicroStation V8i SS3 VBA project.  It compiled without error.

    Have you written other VBA code for MicroStation?  Do your other projects compile and run without error?

     
    Regards, Jon Summers
    LA Solutions

  • Hi,

    pls have a look under Tools/References in your IDE.

    Anything suspicious in there?

    Regards, Stefan.

  • Below your hilighted Error, you have declared a Function ClearDisplay that appears not to return a Value data type that all functions are required to.  If you have no data to return, consider declaring ClearDisplay as a Sub(routine) that by definition does not return any values.

    I would highly recommend the following options be used for debugging all your VBA projects to help identify real problems that VBA is nicely hiding to protect the more casual programmer.

    Recommended settings to configure in a development VBA debugging environment

    • Add “Option Explicit” to the top of all your project source code files (classes, modules, and forms)
    • Validate the following VBA Editor options (Tools > Options) are set in your environment:
      • Editor (Tab) > Require Variable Declaration
      • General (Tab) > Error Trapping: Break on All Errors”.  Use this option for your development cycle setting.   Use the less strict (default) setting “Break on Unhandled Errors” in a production environment setting
      • When atttempting to Run your project and receive Errors, occasionally try:
        Debug > Compile {ProjectName} this can help identify errors elsewhere in the project that may not be obvious.

    HTH,
    Bob



Reply
  • Below your hilighted Error, you have declared a Function ClearDisplay that appears not to return a Value data type that all functions are required to.  If you have no data to return, consider declaring ClearDisplay as a Sub(routine) that by definition does not return any values.

    I would highly recommend the following options be used for debugging all your VBA projects to help identify real problems that VBA is nicely hiding to protect the more casual programmer.

    Recommended settings to configure in a development VBA debugging environment

    • Add “Option Explicit” to the top of all your project source code files (classes, modules, and forms)
    • Validate the following VBA Editor options (Tools > Options) are set in your environment:
      • Editor (Tab) > Require Variable Declaration
      • General (Tab) > Error Trapping: Break on All Errors”.  Use this option for your development cycle setting.   Use the less strict (default) setting “Break on Unhandled Errors” in a production environment setting
      • When atttempting to Run your project and receive Errors, occasionally try:
        Debug > Compile {ProjectName} this can help identify errors elsewhere in the project that may not be obvious.

    HTH,
    Bob



Children