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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saveas and Load codes

Status
Not open for further replies.

episode80

Technical User
Aug 17, 2004
13
FI

I want to create save&load functions behind commandbuttons.

What would be the saveas code that prompts the SaveAs window and saves the current excel document. And it would be good if save format would automatically be xls format and the suggested filename "Project".

And how would the load code look like to this application.

Thank you! :)
 
Maybe silly but have you looked at the common dialog box component?
Look in VB help for what this can preform.

 
At the moment I have this code:

Code:
fileSaveName = Application.GetSaveAsFilename( _
    fileFilter:="Text Files (*.xls), *.xls")
ActiveWorkbook.SaveAs

which works fine if you click OK, but if you click cancel
the programs returns an error.

How to get rid of that?

Thanks in advance!
 
What is the error? cant you just disable the cancel button?
 

Now I have this code. Not the cancel button has no effect but if the user saves the document with the same name there will be a prompt which asks that are you sure that you want overwrite it. Now, if you press there no or cancel button an error will happen.
How can I get rid of that prompt box, so that it will automatically overwrite th prvious version?

And an another quoestion. As you can see from the code I'm trying to save just one sheet, no more but now it still saves the wholw program. How it will save just the one sheet?

Code:
Worksheets("PRINT").Activate

Do
    fName = Application.GetSaveAsFilename( _
    fileFilter:="Text Files (*.xls), *.xls")
Loop Until fName <> False
ActiveSheet.SaveAs Filename:=fName

Thanks!
 
This is because .xls is excel application. .xlt is what you want I believe.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top