1 Reply Latest reply: May 15, 2014 10:01 AM by Bill Watson RSS

    Monarch Not Closing Using VB .Net

    Anthony Young CCF



      I've searched around the forums and really haven't found an answer to my problem but have found similar issues which didn't help too much.  So I hope someone can give me a hand on this. 


      Here is the code I'm having a problem with:


                  Dim MonarchApp As Object = CreateObject("Monarch32")



      I'm able to change the visible property, open models, open reports, export tables, everything I need to but I can't Exit Monarch.  The Exit command doesn't throw any error but it doesn't work.  I look in Task Manager and it is still there after I call it.  I've tried setting it to nothing but that didn't work, I've even called the GC to help collect it but nothing.  Now I have to open Monarch at various times instead of just leaving it open because those times can span hours.  So with Exit not working I end up having multiple instances of Monarch open.  I would rather have one instance open rather than multiple if that is what has to be done but why doesn't Exit work.  I just want to close Monarch after I'm done extracting what I need.  Any ideas anyone?


      I'm using Version 8 Pro

        • Monarch Not Closing Using VB .Net
          Bill Watson

          not sure if this is exactly what you need, but the following works for me in VB Scripts. This should let you reuse an open instance of monarch


          Dim objmon

          set objmon = getobject("","Monarch32")

          if objmon is nothing then

               Set MonarchObj = CreateObject("Monarch32")

          End If



          I would then use objmon.Exit to close monarch. haven't had a problem with it being left hanging about.