View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Automatically Saving A Workbook


Sub SaveFile()
Dim s as String, sName as String
s = "C:\My Documents\Spreadsheet Files\"
On Error Resume Next
Mkdir "C:\My Documents"
MkDir "C:\My Documents\Spreadsheet Files"
On Error goto 0
sName = ActiveWorkbook _
.Worksheets("List").Range("c2").Text & ".xls"
if dir(s & sName) < "" then
kill s & sName
End if
ActiveWorkbook.SaveAs s & sName
end sub

--
Regards,
Tom Ogilvy



"Papa Waigo" wrote:


I would like to be able to save a workbook using a macro, that will save
the file in a particular loaction e.g. C:\My Documents\Spreadsheet
Files\Example Spreadsheet.xls and have the directory created for those
users for whom it does not exist.

I would also like the file to be named according to the contents of
cell c2 on a sheet named "list"

Any help would be much appreciatted.


--
Papa Waigo
------------------------------------------------------------------------
Papa Waigo's Profile: http://www.excelforum.com/member.php...o&userid=36074
View this thread: http://www.excelforum.com/showthread...hreadid=558861