ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA filesavename (https://www.excelbanter.com/excel-programming/283663-vba-filesavename.html)

paul[_10_]

VBA filesavename
 
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

lars kofod

VBA filesavename
 
Yes, you did

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

Lars Kofod
-----Original Message-----
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
.


Patrick Molloyu

VBA filesavename
 
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

-----Original Message-----
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
.


paul[_10_]

VBA filesavename
 
why does it seems so logical when you see it.

Thx to you both




-----Original Message-----
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
.



All times are GMT +1. The time now is 03:28 AM.

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