PDA

View Full Version : Exporting to Excel



RonP
October 4th, 2002, 10:43 AM
Hi all

I am using VBA to export from Mararch 6.0 when I try to import the Excel file to Access XP I get a message stating that the file is not the right format. It seem that the file is being exported as Excel 2.0 format. I have Monarch set to export as Excel 8.0. Can you help me below is the code I am using:

Private Sub cmdBatch_Click()
Dim MonarchObj As Object
Dim OpenFile, openmod, t As Boolean

Set MonarchObj = GetObject("", "Monarch32")
If MonarchObj Is Nothing Then
Set MonarchObj = CreateObject("Monarch32")
End If
t = MonarchObj.SetLogFile("C:MonTempMPrg_G5.log", False)

OpenFile = MonarchObj.SetReportFile("y:kls_kmw3270phuphutoday", False)

If OpenFile = True Then
openmod = MonarchObj.SetModelFile("y:kls_kmwMonarchModPick Detail Holdup Model W.mod")

If openmod = True Then
MonarchObj.CurrentFilter = "Div"
MonarchObj.ExportTable ("Y:kls_kmwexcelholdupsDailyHU.xls")
End If
End If
MonarchObj.CloseAllDocuments

MonarchObj.Exit
End Sub

Thanks
Ron

Winn
October 10th, 2002, 12:09 PM
Ron,

There is nothing that you can do about this. If you look up the ExportTable or ExportSummary functions in the Monarch Programmers Guide, it states that, "The export file type is limited to the Monarch V3 capabilities and determined by the file extension specified for export file ...". The version of Excel supported by Monarch v3 is version 2.1.
You can try saving the Excel spreadsheet to a higher version after Monarch has exported to it and before importing to Access. That may resolve your problem.
Hope that helps.

RonP
October 10th, 2002, 02:51 PM
Thanks for the info, No that did not help either. For some reason there are about 2 thirds of the records do not get imported, only the records that have data in one of the fields. Not sure why. I guess I will still have to use the autoscrip and batch files.

Gareth Horton
October 15th, 2002, 03:09 PM
Ron,

Take a look at this thread.

Monarch 6 Pro Automation (http://mails.datawatch.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=1;t=000015#000003)

[ May 01, 2006, 05:40 PM: Message edited by: Todd Niemi ]

Stephen Reid
October 21st, 2002, 10:55 AM
I dont know if this helps but if you have professional version of monarch then you can use the jet export table command as opposed to the export table command. This allows you to export to newer versions.

Stephen