VBA Saveas

Miya

Well-known Member
Joined
Nov 29, 2008
Messages
662
Hi when i use this code, and try to choose a file to saveas, the code still appears to keep the same file name as the current workbook, it does not overide, am i missing something?

fName = Application.GetSaveAsFilename _
(InitialFileName:=Range("rngPath").Value, _
FileFilter:="Microsoft Excel workbook (*.xls), *.xls", _
Title:="Save As")
If fName = False Then Exit Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
That's getting the name choice ... I don't see that you are actually doing the save there. Does that happen later in the code ... or were you under the impression that GetSaveAsFilename did the save for you?
 
Upvote 0
That's getting the name choice ... I don't see that you are actually doing the save there. Does that happen later in the code ... or were you under the impression that GetSaveAsFilename did the save for you?

I thought this code did it all. What do I need to do then?
 
Upvote 0
That command gets the choice of name from the user ... it's up to you to save the file, like:
Code:
ActiveWorkBook.SaveAs fname



Or you could use this:

Code:
Application.Dialogs(xlDialogSaveAs).Show arg1:=Range("rngPath").Value

instead of using GetSaveAsFilename, as that does the saving.
 
Upvote 0
That command gets the choice of name from the user ... it's up to you to save the file, like:
Code:
ActiveWorkBook.SaveAs fname

Or you could use this:

Code:
Application.Dialogs(xlDialogSaveAs).Show arg1:=Range("rngPath").Value
instead of using GetSaveAsFilename, as that does the saving.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top