ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   new template & save on first open (https://www.excelbanter.com/excel-programming/434662-new-template-save-first-open.html)

Krystal Peters[_2_]

new template & save on first open
 
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,

Dave Peterson

new template & save on first open
 
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



Krystal Peters wrote:

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,


--

Dave Peterson

Krystal Peters

new template & save on first open
 
That works! yeah!

"Dave Peterson" wrote:

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



Krystal Peters wrote:

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,


--

Dave Peterson



All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com