View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ppyxl[_11_] ppyxl[_11_] is offline
external usenet poster
 
Posts: 1
Default How to call macro from other workbook


code is not working, pls check for me. Many thanks
____________________________
Sub SaveFO2()

-'define date-

Dim ReportDate, LsReportDate As Date
Dim ReportName, directoryName As String

LsReportDate = Workbooks("startup").Sheets("FO2").Range("B2")
ReportDate = Workbooks("startup").Sheets("FO2").Range("B3")

-'save from one file to another-

Workbooks.Open fileName:=("K:\Reporting\XL\DataBase\FO2 "
Format(LsReportDate, "yyyymmdd") & ".xls"), updatelinks:=0

ActiveWorkbook.SaveAs "K:\Reporting\XL\DataBase\FO2 "
Format(ReportDate, "yyyymmdd") & ".xls"

-'define some strings-
directoryName = "K:\Reporting\XL\DataBase\FO2 " & Format(ReportDate
"yyyymmdd")
ReportName = "FO2 " & Format(ReportDate, "yyyymmdd") & ".xls"

Sheets("Input_Working").Activate
Cells(2, 4).Value = ReportDate

-'run macro-
Application.Run ReportName!Main

End Su

--
ppyx
-----------------------------------------------------------------------
ppyxl's Profile: http://www.excelforum.com/member.php...fo&userid=3611
View this thread: http://www.excelforum.com/showthread.php?threadid=56064