5 Replies Latest reply: May 15, 2014 9:57 AM by RalphB _ RSS

    Automating Monarch

    Dion Osborn

      I built a routine in VBA/Excel that automates Monarch to print out a filtered table.  Everything works fine, but I want to do more. Can I change the printer Monarch uses with my code?  From looking at the documentation, I don't think I can.  Has anyone tried this?  Could I use Send Keys?  Do I need to export the table to gain the flexibility in printers?  I was hoping I could remain in Monarch.  Using Automation is going to enable me to do A LOT more with Monarch.

       

      TIA,

      Dion

        • Automating Monarch
          Melissa2 _

          Originally posted by Dion Osborn:

          I built a routine in VBA/Excel that automates Monarch to print out a filtered table.  Everything works fine, but I want to do more. Can I change the printer Monarch uses with my code?  From looking at the documentation, I don't think I can.  Has anyone tried this?  Could I use Send Keys?  Do I need to export the table to gain the flexibility in printers?  I was hoping I could remain in Monarch.  Using Automation is going to enable me to do A LOT more with Monarch.

          TIA,

          Dion[/b][/quote]Dion,

           

          I'm not sure of the code you are using in excel/vba but maybe you could use:

           

          MonarchObj.ExportTable ("c:TestExport.xls")

           

          instead of printing directly from Monarch.

           

          then:

           

          Workbooks.Open FileName:="C:TestExport.xls"

           

          to open the file in Excel

           

          then:

           

          Application.ActivePrinter = "enter the path of your printer here"

           

          to change the default printer name

           

          then:

           

          ActiveSheet.PrintOut

           

          to print the data.

           

          Printing from Excel allows you to format your data to make it easier to read for the end user (which you could do automatically using VBA).  I love automation <g>.

           

          Melissa

          • Automating Monarch
            Joel Heyman

            I use WinBatch to automate my Monarch sessions.  They have a one line statement to change your default printer: 

             

            pSetDefPrt("name of printer")

             

            MonarchObj.PrintTable(@True) then prints my table.

            • Automating Monarch
              Sandy McQuay

              Sorry, this is not really a response to the question. 

               

              This is really directed to Joel Heyman (or anyone else) using Winbatch/OLE to automate Monarch.  I'm trying to get the hang of OLE stuff and it hasn't quite clicked.  I'd appreciate any tips!

               

              Thanks,

              • Automating Monarch
                Wes Groleau

                Originally posted by Melissa:

                I'm not sure of the code you are using in excel/vba but maybe you could use:

                 

                MonarchObj.ExportTable ("c:TestExport.xls")

                 

                instead of printing directly from Monarch.

                /quoteThis looks like something I could use.

                 

                But don't I first have to tell Monarch the input file name and the model ?

                • Automating Monarch
                  RalphB _

                  Originally posted by Wes Groleau:

                    /size[quote]quote:[/size]

                  Originally posted by Melissa:

                  I'm not sure of the code you are using in excel/vba but maybe you could use:

                   

                  MonarchObj.ExportTable ("c:TestExport.xls")

                   

                  instead of printing directly from Monarch.

                  /quoteThis looks like something I could use.

                   

                  But don't I first have to tell Monarch the input file name and the model ? /b[/size][/QUOTE]Wes,

                   

                  Check out the Monarch Programmers Guide [url="http://www.datawatch.com/pdf/products/monarch/Monarch_8_Programmers_Guide.pdf"]here[/url] .

                   

                  It gives sample codes that shows how to use the OLE commands.  Some of the commands only work on newer versions but many will work on your version.

                   

                  If you have any other questions on how to do some coding, post back here.  There are several users that use vb to automate Monarch.