GetSaveAsFilename not responding

B

Bishop

I have the following code in a procedure:
AUserFile = Application.GetSaveAsFilename(InitialFileName:=IFN, _
FileFilter:="Microsoft Office Excel Workbook(*.xls),*.xls", _
FilterIndex:=1, Title:="You Must Save Before You Proceed")

The box pops up with name I specify. The InitialFilename parameter fills in
as I specify. But when I click Save nothing happens. The file name remains
the same and when I look in the folder where I am trying to save the file
there's nothing there. Why doesn't it work?
 
D

Dave Peterson

GetSaveAsFileName doesn't save the file. It only gets the name from the user.

Dim auserfile as variant
auserfile = application.getsaveasfilename(...)

if auserfile = false then
'user hit cancel, what should happen?
else
whateverworkbookyou'reworkingon.saveas filename:=auserfile, _
fileformat:=xlworkbooknormal
end if

Much like the suggestion you got in the other thread.
 
G

GS

The GetSaveAsFilename function only returns the full path and filename to
'Save As'. Now that it is loaded into your variable, you must execute the
SaveAs method to actually save the file.

Example: ActiveWorkbook.SaveAs AUserFile

HTH
Kind regards, Garry
 
B

Barb Reinhardt

Isn't the fileformat for .xls 56 or xlExcel8, not xlWorkbookNormal (51?).
 
D

Dave Peterson

xlworkbooknormal = -4143
in xl2003.

So I guess it would depend on what version of excel the OP is using.
 

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