Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has anyone used VBA to control a Monarch session 1

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Monarch is a data extraction program which converts .prn files into Databases, Excel Workbooks, etc. It exposes some properties and methods but I cannot find an application object to instantiate.

I have tried the following with no success:

a. Dim objMonarchObj As Monarch.Application
b. Dim objMonarchObj As Object

c. Set objMonarchObj = GetObject("fullpath and filename")

When you bring it into the list via Tools, References it only exposes one object, something named Monarch.

Any ideas or suggestions? Thanks in advance!
 
I have had much success with the Autoscript that comes with the monarch program.
You can reference Monarch in a Batch file and create a database. Then you can import that database into your Access application. The problem that I had was that when you call a batch file -- VB immediately executes the next line of code before continuing.
To get around this I put a do loop in the code and the last step of the batch fiel - the creation of a flag file.
The do loop says do until dir$(flagfile) <> &quot;&quot;
Let me know if you need any other assistance - I use Monarch and batch fiels to automate Monarch all the time.
Thanks
Tim
 
Thanks, Tim! I eventually found the link you referenced above. Using the information I found there, I have been able to instantiate Monarch from within Excel VBA and have it open a report file and export it based on a given model.
It has been in production for a couple months with no problems.

Its not clearly documented anywhere that I found, but if you provide an .xls or .mdb extension it will create an Excel spreadsheet or Access database during the export process. I have had some problems getting an Excel file created in that manner to import into Access if needed. It works OK manually but fails using DoCmd.TransferSpreadsheet.

If you post an email address I'll be happy to send you the code. It is pretty straight forward.

Have a great day!

 
By the way, welcome aboard. I see you are a recent addition. This is a great site.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top