ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Any way to set the Default Filename for a new document? (https://www.excelbanter.com/excel-programming/272763-any-way-set-default-filename-new-document.html)

Tim[_18_]

Any way to set the Default Filename for a new document?
 
I have an Excel Template (XLT) I've created. When the user creates a new file
from the template, it asks for certain information and fills those in on the
form automatically.

When the user goes to save, I'd like to have the default filename given in the
Save As dialog box be something like "Price Quotation - [Company Name
Here].xls". Right now, when you go to save, it is the same name as the XLT plus
a "1" at the end....

Anyway to set this in VBA?



Heiko

Any way to set the Default Filename for a new document?
 
Hello Tim

Public Function mySaveAs()
Dim varName
Dim strDefault
strDefault = "Price Quotation - [Company Name Here]"
With ActiveWorkbook
If Not .Saved Then
varName = .Application.GetSaveAsFilename(strDefault,
"Microsoft Excel (*.xls),*.xls", , "Overwrite only Company")
If varName = False Then
Exit Function
End If
End If
End With
mySaveAs = varName
MsgBox varName
End Function

Heiko
:-)

"Tim" wrote:

I have an Excel Template (XLT) I've created. When the user creates a new file
from the template, it asks for certain information and fills those in on the
form automatically.

When the user goes to save, I'd like to have the default filename given in the
Save As dialog box be something like "Price Quotation - [Company Name
Here].xls". Right now, when you go to save, it is the same name as the XLT plus
a "1" at the end....

Anyway to set this in VBA?




D. A. Gray

Any way to set the Default Filename for a new document?
 
Add a reference to the Common Controls library and use the
Save As function. You can set everything about the dialog
box, including the default file name, file name filters,
and default target directory.

David Gray
P6 Consulting
http://www.p6c.com/

You are more important than any technology we may employ.


-----Original Message-----


When the user goes to save, I'd like to have the default

filename given in the
Save As dialog box be something like "Price Quotation -

[Company Name
Here].xls". Right now, when you go to save, it is the

same name as the XLT plus
a "1" at the end....

Anyway to set this in VBA?


.



All times are GMT +1. The time now is 08:19 PM.

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