View Single Post
  #1   Report Post  
Dolphinv4
 
Posts: n/a
Default Activate Workbook

Hi,

I have a macro in workbook "AP.xls" that (1) save a backup copy then (2)
open other workbooks as follows:

Dim myDate As String
Dim myFileName As String

myDate = Format(Date, "yymmdd")
myFileName = "C:\" & myDate & " Main.xls"
ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlWorkbookNormal

Workbooks.Open Filename:="C:\1.xls"
Workbooks.Open Filename:="C:\2.xls"

THEN i want to activate the newly saved workbook again by adding the
following code, but it doesn't work. Why?

ActiveWorkbook.Activate Filename:=myFileName, FileFormat:=xlWorkbookNormal

Regards,
Dolphin