View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
bawahoo[_3_] bawahoo[_3_] is offline
external usenet poster
 
Posts: 1
Default 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