new template & save on first open

  • Thread starter Thread starter Krystal Peters
  • Start date Start date
K

Krystal Peters

Developing a template for a monthly report. I want when the template is
first used to prompt to save the file using this format "filename - month
year" .xls

I am able to get month and year, but cannot get the file to save when the
template is first used? Know to use Workbook_Open() on the ThisWorkbook
module...

Any suggestions? Thanks,
 
Maybe something like:

Option Explicit
Private Sub Workbook_Open()
If Me.Path = "" Then
'still a template
Me.SaveAs Filename:="C:\somepath\somefilename - " _
& Format(Date, "mmm - yyyy") & ".xls", FileFormat:=xlWorkbookNormal
End If
End Sub
 
That works! yeah!

Dave Peterson said:
Maybe something like:

Option Explicit
Private Sub Workbook_Open()
If Me.Path = "" Then
'still a template
Me.SaveAs Filename:="C:\somepath\somefilename - " _
& Format(Date, "mmm - yyyy") & ".xls", FileFormat:=xlWorkbookNormal
End If
End Sub
 
Back
Top