new template & save on first open

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,
 
D

Dave Peterson

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
 
K

Krystal Peters

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top