View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Save to directory and create if not exist

Hi Rob

Untested

Sub Test()
Dim dirstr As String
Dim wb As Workbook

ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb.Sheets(1).UsedRange
.Value = .Value
End With

dirstr = "C:\my documents"
If Not DirectoryExist(dirstr) Then
MkDir dirstr
wb.SaveAs dirstr & "\ron.xls"
Else
wb.SaveAs dirstr & "\ron.xls"
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Rob" wrote in message ...
Hi,

Does anyone have some sample code to help me achieve the following: copy a sheet to a new workbook with contents as values as
opposed to formula, then save the new workbook in a directory (e.g. C:\my documents\) but if the directory doesn't exist, create
the directory and then save the file. I would like to do this in one routine if possible.

Thanks, Rob