ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting the save prompt (https://www.excelbanter.com/excel-programming/399540-getting-save-prompt.html)

Sonnich Jensen[_2_]

Getting the save prompt
 
Browsing this group, I found that I have an odd problem - I would like
to get the save prompt, but I dont.

I have tried using stuff like activeworkbook.save

' save the document
NewWkBk.Save

My problem: I want to prompt the user for a filename, so it can be
saved... but that does never happen, the code above just gives me a
file like book8.xls in the default dir

How do I pop the save dialog?

WBR
Sonnich


JW[_2_]

Getting the save prompt
 
Sub example()
Dim fName As Variant
Dim NewWkBk As Workbook
'change as needed
Set NewWkBk = ActiveWorkbook
fName = Application.GetSaveAsFilename _
(filefilter:="Excel Files (*.xls),*.xls")
If fName = False Then Exit Sub
NewWkBk.SaveAs fName
End Sub

Sonnich Jensen wrote:
Browsing this group, I found that I have an odd problem - I would like
to get the save prompt, but I dont.

I have tried using stuff like activeworkbook.save

' save the document
NewWkBk.Save

My problem: I want to prompt the user for a filename, so it can be
saved... but that does never happen, the code above just gives me a
file like book8.xls in the default dir

How do I pop the save dialog?

WBR
Sonnich




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

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