Saving a spreadsheet using userform command buttons


Posted by J Tompson on August 15, 2001 4:06 AM

Hi,

I would like to save a workbook using a button on a user form. The catch is i want to save it with out being promted and with out the macros attached. I would also like to use a cell's contents to act as the file name.

I'm using excel 97 which seems to cause a lot of problems but any hel;p would be greatly appreciated.

I was given this code but it doesn't seem to work...

Private sub Commandbutton1_click()
Dim Fs as string

Fs = application.getsaveasfilename(textbox2.value, filefilter:= "Microsoft Excel File (*.xls), *.xls")
If Fs = "False" Then exit sub
Thisworkbook.saveas Fs

End sub

Cheers,
John

Posted by J Tompson on August 15, 2001 4:09 AM

Sorry, forgot some info...


Sorry, i forgot to mention I would like to save the file to a predetermined location eg c:\data\quotations\

Cheers

Posted by Dax on August 15, 2001 4:19 AM

Re: Sorry, forgot some info...


Thisworkbook.SaveAs "C:\Data\Quotations\Anyname.xls"

Dax.

Posted by J Tompson on August 15, 2001 4:41 AM

Cheers, thats boringly easy!


Thanks

Posted by J Tompson on August 15, 2001 4:55 AM

One more problem....

Hello again,

Last question...
Can i name the file by referencing it to a cell?

I tried ThisWorkbook.SaveAs "C:\Data\Quotations\("QuotationNumber").xls"

QuotationNumber is a direct reference to a cell on the worksheet but the code doesn't work. Any ideas?

Cheers



Posted by Dax on August 15, 2001 5:39 AM

Re: One more problem....

Last question...

ThisWorkbook.SaveAs "C:\Temp\" & Range("QuotationNumber")

Regards,
Dax.