ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   save worksheets within workbook (https://www.excelbanter.com/excel-programming/314449-save-worksheets-within-workbook.html)

bawahoo[_3_]

save worksheets within workbook
 

What I am trying to do is run a macro that will take a dat file, then d
the MOD and save into excel. Then take another dat file do the same MO
and save it in another worksheet within the same workbook file. So
guess my gold is to try to save many worksheets within one workbook.
Thanks for your help.
====

Set MonarchObj = CreateObject("Monarch32")

With MonarchObj

openfile = .SetReportFile("D:\Cash and Ad
Report\cash0902.dat", False)
If openfile = True Then
openmod = .SetModelFile("D:\Cash and Ad
Report\Cash_Adj_Rpt.mod")
If openmod = True Then
.CurrentFilter = "Cash01"
.ExportTable ("D:\Cash and Ad
Report\Cash_Adj_Rpt_09.xls")
Workbooks.Open Filename:="D:\Cash and Ad
Report\Cash_Adj_Rpt_09.xls"
Sheets(1).Copy Befo=Workbooks("Book1").Sheets(1)
End If
End If

openfile = .SetReportFile("D:\Cash and Ad
Report\cash0903.dat", False)
If openfile = True Then
openmod = .SetModelFile("D:\Cash and Ad
Report\Cash_Adj_Rpt.mod")
If openmod = True Then
.CurrentFilter = "Cash02"
.ExportTable ("D:\Cash and Ad
Report\Cash_Adj_Rpt_09.xls")
Workbooks.Open Filename:="D:\Cash and Ad
Report\Cash_Adj_Rpt_09.xls"
Sheets(1).Copy Befo=Workbooks("Book1").Sheets(1)
End If
End If

.CloseAllDocuments
.Exit

End With
Application.Quit

End Su

--
bawaho
-----------------------------------------------------------------------
bawahoo's Profile: http://www.excelforum.com/member.php...fo&userid=1510
View this thread: http://www.excelforum.com/showthread.php?threadid=27168



All times are GMT +1. The time now is 03:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com