5 Replies Latest reply: May 15, 2014 9:59 AM by Nick Osdale-Popa RSS

    Automate monarch as hidden?

    Michael Lane

      Hi,

       

      I was wondering if anyone knows a way to run monarch in the background or hidden so that it does not show up during my main program execution.  I have a process that opens a text file, applies a model, and outputs an excel file, but the monarch window pops up and does its work, then disappears.  Is there a way to prevent the monarch window from being visible?

       

      I'm using VB and monarch 7 Pro on XP.

       

      Thanks,

      Michael Lane

        • Automate monarch as hidden?
          Data Kruncher

          Hi Michael,

           

          In fact, you've supplied the answer yourself!    

           

          Supposing that you've created on object to control Monarch named ObjMonarch, you can code: [font="courier"]objMonarch.Visible = False[/font][/quote]to hide the instance, and

          [font="courier"]objMonarch.Visible = True[/font][/quote]to display it. Obviously, the default value for the Visible property is True.

           

          Note that this is not documented in the programmers manual, but is common for automation objects.

           

          Kruncher

          • Automate monarch as hidden?
            Michael Lane

            Wow!  I'm astounded that didn't smack me in the face to begin with!  Thanks for the answer.

            • Automate monarch as hidden?
              Nick Osdale-Popa

              Just keep in mind that this will not hide the progress bar. This, in my opinion, is a good thing as you can see that Monarch is running.

               

              Another option is to use the DisplayWindow() function which is documented. Just pass the parameter of 2 and the windows will be minimized, which is good for debugging purposes.

               

               

              As a side note, you can find all the Functions/Procedures available to Monarch by following this routine:

               

              Open Excel ( my personal choice ), display the VBA IDE ( Alt-F11 ), click Tools|References, browse to the Monarch Program folder (normally C:Program FilesMonarchProgram ), select the Monarch.tlb file, and then click OK.

               

              Now click View|Object browser ( or press F2 ), and select MonarchLib in the top drop-down box. This will give you the list of all the Function and Procedures available.

               

              Hope the helps!

              • Automate monarch as hidden?
                Data Kruncher

                Good input Nick. You keep me on my toes, striving for continuous improvement in both my own work and my posts here. Sincere thanks.

                 

                To continue this technical discussion just a bit more, and forgive me if you've told me already, or worse, shown me   redface.gif[/img]  , have you wrapped up all your Monarch interaction code in a reusable class module? I recently picked up a copy of  [url="http://www.amazon.com/gp/product/0321262506/104-4395825-2231917?v=glance&n=283155"]Professional Excel Development[/url] (highly recommended), and it's got me thinking about these sorts of things. Do you think this would be a worthwhile exercise?

                 

                I know you have much experience developing class modules, and I'm trying to put a lot of theory into practice, so please excuse me if this is one idea that just won't pan out in the real world.   smile.gif[/img] 

                 

                Kruncher

                • Automate monarch as hidden?
                  Nick Osdale-Popa

                  Whoa, missed your reply somehow.  Yes, as soon as I saw that Monarch had a COM object I immediately took the code from the Monarch Programmer's Manual (Version 3 at the time) and translated it into a Class Module.  It's not very elegant, and I do still tweak it at times when I need to add in a functionality I hadn't considered before.

                   

                  P.S. I also had that book pre-ordered when I saw that it was coming out.