VBA filesavename

P

paul

filesavename = Application.GetSaveAsFilename(Range("h9"))

dear ,

above line activated by a "click/button" event. which
reacts quit fine.

I get a window to search for the wanted folder and the
opportunity to save the file with name created in the cell
h9.

However after pressing "save" the window closses but
nothing has been saved!!

did I forgot something?


kind regards

Paul
 
L

Lars Kofod

Yes, you did

FileSaveName = Application.GetSaveAsFilename(Range("h9"))
ActiveWorkbook.SaveAs FileSaveName

Lars Kofod
 
P

Patrick Molloyu

the method simply returns the name that you selected to
be saved.

you need to add:

thisworkbook.SaveAs filesavename

to complete the task. Ideally, your cell woul dhave the
full file path, not just the name. If you dont' have the
full path, then your method is a great way to locate the
relevent folder.


generally, since you have the file name already, you
wouldn't need to use the GetDaveAsFilename method. This
is best used for when the user needs to browse to a
folder then name or overwrite a file.

HTH
Patrick Molloy
Microsoft Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top