3 Replies Latest reply: May 15, 2014 9:55 AM by Michael Lane RSS

    VBA project Export

    Michael Lane

      I have a project file with a project export defined that I would like to automate through a VBA script. I can open the .prj file through vba, but I can't seem to find the command to run the project export.  Is this possible to do using VBA?  If so, how would I go about doing this?


      I'm using Monarch Pro version 7.00 on winXP SP2, and MS Access 2003.


      [size="1"][ March 17, 2006, 12:01 PM: Message edited by: Michael Lane ][/size]

        • VBA project Export
          Michael Lane



          Thanks for the quick response. I had taken a look at that, but it seems to say that I can only overwrite files or create new files.  I need to append the information into an existing table in an existing access database.  In addition, the project export that I have created uses a filter and I didn't see an option to specify a filter. 


          Is this sort of automation available through the command line?  If not, is it possible through VBA?


          Yes, I actually just downloaded the programmer's guide earlier this morning.


          • VBA project Export
            Data Kruncher



            I don't have v7 Pro, but with 8 Pro you cannot append to a table with the command line. I'll assume that this is also true for v7 Pro. So, instead you must use the JetExportTable command:


            [font="courier"]JetExportTable(FileName, TableName, 2) /font[/quote]The 2 parameter indicates that you want to append to the table. Use 0 to overwrite the table, or 1 to create a new table.


            As to the filter, you want to set the CurrentFilter property. One caution here: always check to see that the filter you specified was applied. If you specified a filter name that doesn't exist in the model, Monarch just charges on with the current filter without raising an error condition.


            I like to do something like this:

            [font="courier"]objMonarch.CurrentFilter = strMyFilter

            If objMonarch.CurrentFilter <> strMyFilter Then

               'exception code goes here

               Msgbox "Requested Filter does not exist!"

               Goto FilterError

            End If[/font][/quote]See the Programmer's Guide for full descriptions of the above.


            There are quite a few programming examples posted on the forum now, but if you need more help, just ask.




            [size="1"][ March 17, 2006, 03:17 PM: Message edited by: Data Kruncher ][/size]

            • VBA project Export
              Michael Lane

              Excellent! Thank you Todd and Kruncher.  I accidentally overlooked the /px option in the help file.  Plus, JetExportTable seems to do exactly what I wanted now. Thanks again.