ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Application.GetSaveAsFilename (https://www.excelbanter.com/excel-discussion-misc-queries/447784-application-getsaveasfilename.html)

[email protected]

Application.GetSaveAsFilename
 
Major novice requiring assistance.

Using the following for a button (very basic) but whilst it opens as expected (save as) it doesn't actually save.

Sub Xxxxxx_SaveAs()

Application.GetSaveAsFilename


End Sub


I hear it may be a compatibility issue, but if anyone can provide an alternative to solve my problem, it would be most appreciated.

Cheers

GS[_2_]

Application.GetSaveAsFilename
 
presented the following explanation :
Major novice requiring assistance.

Using the following for a button (very basic) but whilst it opens as expected
(save as) it doesn't actually save.

Sub Xxxxxx_SaveAs()

Application.GetSaveAsFilename


End Sub


I hear it may be a compatibility issue, but if anyone can provide an
alternative to solve my problem, it would be most appreciated.

Cheers


It does exactly what its name implies; it returns the filename you want
to save as. You actually have to save it using Application.SaveAs and
pass the filename obtained...

Dim vFileToSave As Variant
With Application
vFileToSave = .GetSaveAsFilename
If vFileToSave = False Then Exit Sub '//user cancels
.SaveAs Filename:=vFileToSave
End With 'Application

--
Garry

Free usenet access at
http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



[email protected]

Application.GetSaveAsFilename
 
On Tuesday, December 4, 2012 5:56:56 PM UTC, GS wrote:
mctavish14 presented the following explanation :

Major novice requiring assistance.




Using the following for a button (very basic) but whilst it opens as expected


(save as) it doesn't actually save.




Sub Xxxxxx_SaveAs()




Application.GetSaveAsFilename






End Sub






I hear it may be a compatibility issue, but if anyone can provide an


alternative to solve my problem, it would be most appreciated.




Cheers




It does exactly what its name implies; it returns the filename you want

to save as. You actually have to save it using Application.SaveAs and

pass the filename obtained...



Dim vFileToSave As Variant

With Application

vFileToSave = .GetSaveAsFilename

If vFileToSave = False Then Exit Sub '//user cancels

.SaveAs Filename:=vFileToSave

End With 'Application



--

Garry



Free usenet access at http://www.eternal-september.org

Classic VB Users Regroup!

comp.lang.basic.visual.misc

microsoft.public.vb.general.discussion


Garry,

Thanks for the reply. Both codes now open the Save As window and populate the File name: field with that of the workbook, but it still does not save to any location you select. You click Save and expect it to have worked, as there's no error or sign that it has not worked, but the file is not there.

The Save as type: field is All Files (*.*) is this an issue?

I'm guessing I need something a lot more complex than my current skills can cater for.

GS[_2_]

Application.GetSaveAsFilename
 
The GetSaveAsFilename function includes the path and so is passed to
the Workbook.SaveAs function.

Oops! I see I did not include a ref to the workbook. Sorry about
that...

Dim vFileToSave As Variant

vFileToSave = Application.GetSaveAsFilename
If vFileToSave < False Then _
ActiveWorkbook.SaveAs Filename:=vFileToSave

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 11:54 PM.

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