Emoncada
12-26-2007, 07:35 PM
I have this code that works great
Public FilePath As String
Sub SaveAs()
Dim strSaveAsFile As String, fp As String
FilePath = ""
' Change the FilePath to suit
fp = "C:\Depot Outgoing\"
Call MakeFolders(fp)
Call MakeFolders(Format(Date, "yyyy") & "\")
Call MakeFolders(Format(Date, "mmmm yyyy") & "\")
Call MakeFolders(Format(Date, "mmm dd") & "\")
strSaveAsFile = "Pim " & (Format(Date, "mm.dd.yy")) & " AC" & ".xls"
ActiveWorkbook.SaveAs FilePath & strSaveAsFile, xlWorkbookNormal
FilePath = ""
End Sub
Private Sub MakeFolders(fp As String)
FilePath = FilePath & fp
If Dir(FilePath, vbDirectory) = "" Then MkDir FilePath
End Sub
I want it to run when a cmdbutton is clicked and cell value a2 is empty.
Then have the spreadsheet save itself every 10 minutes. Can this be done?
Public FilePath As String
Sub SaveAs()
Dim strSaveAsFile As String, fp As String
FilePath = ""
' Change the FilePath to suit
fp = "C:\Depot Outgoing\"
Call MakeFolders(fp)
Call MakeFolders(Format(Date, "yyyy") & "\")
Call MakeFolders(Format(Date, "mmmm yyyy") & "\")
Call MakeFolders(Format(Date, "mmm dd") & "\")
strSaveAsFile = "Pim " & (Format(Date, "mm.dd.yy")) & " AC" & ".xls"
ActiveWorkbook.SaveAs FilePath & strSaveAsFile, xlWorkbookNormal
FilePath = ""
End Sub
Private Sub MakeFolders(fp As String)
FilePath = FilePath & fp
If Dir(FilePath, vbDirectory) = "" Then MkDir FilePath
End Sub
I want it to run when a cmdbutton is clicked and cell value a2 is empty.
Then have the spreadsheet save itself every 10 minutes. Can this be done?