Suggest a filename for SaveAs

J

Jimbob

Hello
I'm using Excel 2003 and want to suggest a filename to users from a cell
within a workbook. Although I want to suggest the name of the file, I want
them to be able to browse to ensure the file is located in their own choice
of folder.

The code I have is:
ActiveWorkbook.saveAs Filename:=("AD1").Value

This just saves the file in the same folder as its source.

Any clues please?
 
J

JW

Hello
I'm using Excel 2003 and want to suggest a filename to users from a cell
within a workbook. Although I want to suggest the name of the file, I want
them to be able to browse to ensure the file is located in their own choice
of folder.

The code I have is:
ActiveWorkbook.saveAs Filename:=("AD1").Value

This just saves the file in the same folder as its source.

Any clues please?

Application.GetSaveAsFilename Range("AD1").Value
 
R

Ron de Bruin

Hi Jimbob

You can use GetSaveAsFilename
Here is a tester that use SaveCopyAs

Sub Test1()
Dim fname As Variant
Dim Wb As Workbook
Set Wb = ActiveWorkbook

Again:
fname = Application.GetSaveAsFilename(Sheets("Sheet1").Range("AD1").Value, _
fileFilter:="Excel Files (*.xls), *.xls")
If fname = False Then Exit Sub
If Dir(fname) <> "" Then GoTo Again
Wb.SaveCopyAs fname
End Sub
 
J

Jimbob

Apologies that I haven't been able to re-visit this item until now.

Very many thanks for your help on this. It works, but . .

Ron, when I execute your solution, a copy of the workbook is saved with its
new name but the version on screen retains the original name.
Why should this be please, and how to prevent it so that the active workbook
is the saved one?

Thanks again
 

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

Similar Threads


Top