2014年1月2日 星期四

VBA Excel file SaveAS overwrite then close

Reference:
http://www.actuarialoutpost.com/actuarial_discussion_forum/archive/index.php/t-229928.html

Set myxlapp = CreateObject("excel.application")
myxlapp.Workbooks.Add Template:=CurrentProject.Path & "\template.xltx"
 myxlapp.Visible = True
With myxlapp.Sheets(1)
  .Cells(2, 3).Value = "明細"
End With
myxlapp.DisplayAlerts = False
myxlapp.ActiveWorkbook.saveas "c:\tmp\xx.xlsx"
myxlapp.ActiveWorkbook.Close (True)

沒有留言:

張貼留言