ActiveWorkbook.Close function

G

Guest

Is there a way to prefill in the "File Name:" in the Save As window when
using the ActiveWorkbook.Close function?

I want to prefill the filed with the name of the file opened with

DataFileName = Application.GetOpenFilename(filefilter:="Text or ASC Files,
*.txt; *.asc", Title:="Select the Data File")

Want the workbook name to be the same name as that opened by DataFileName
(less the .txt or .asc extension) and not "Sheet1".

Thanks
 
N

News

Just do a
WB.SaveAs NameYouWant.xls,xlWorkbookNormal
then when you close, the SaveAs dialog will not show.

NickHK
 
G

Guest

I want to still prompt them on saving but I wanted to prefill in the name of
the file into the File Name field of the Save As window.
 
G

Guest

Something is not working. Where do I set this statement?

Also I want to keep the workbook open after saving the file.
 
N

NickHK

Before you wish to .SaveAs the file, the same as you are using the
GetOpenFilename before you .Open the file initially.

As for keeping the file open, don't .Close it then, although I thought was
the whole point going by your subject line.

NickHK
 

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

Top