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

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

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?
 
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
:-)
 
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?


.
 
Back
Top