Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear Dialog Box 1

Status
Not open for further replies.

lorrie3292

Programmer
Oct 26, 2009
2
US
I created this macro to force the user to save the file as (something else) so that the original file is preserved:

Sub Save_file_as()

'Bring up SaveAs menu
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

'If user specified file name, perform Save and display msgbox
If fileSaveName <> False Then
ActiveWorkbook.SaveAS Filename:=fileSaveName, FileFormat:=xlNormal
MsgBox "THIS FILE WAS SAVED AS " & fileSaveName
End If

End Sub

When the dialog box comes up to type in the new name I would like the file name that appears to automatically be deleted (empty). What code do I need to use and on what line?

Thank you!
 
You can just specify a blank InitialFilename parameter, e.g.
Code:
filesavename = Application.GetSaveAsFilename(InitialFileName:="", _
        fileFilter:="Excel Files (*.xls), *.xls")
Hope this helps

Andy
---------------------------------
[green]' Signature removed for testing purposes.[/green]

 

lorrie,

Don't forget to...
[blue]
Thank HarleyQuinn
for this valuable post!
[/blue]

The [purple]little purple Stars[/purple] accomplish several important things.

First, it gives positive feedback to contributors, that their posts have been helpful.

Second, it identifies threads as containing helpful posts, so that other members can benefit.

And third, it identifies the original poster (that's YOU, BTW), as a grateful member, that not only receives, but is willing to give tokens of thanks.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top