I'm trying to use an if statement to save a file to the temp directory, if it exist, and save it to the network drive it a temp dorectory doesn't exist.
I think I'm close, but my searches in the forum didn't turn up anything to get me over the hump.
Here's what I've got:
If Exist "C:\Temp" Then
ActiveWorkbook.SaveAs Filename:="C:\Temp\PO Response Tracking - Temp" & Format(Now, "hhmmss") & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
GoTo Temp
Else
ActiveWorkbook.SaveAs Filename:="M:\PO Response Tracking - Temp" & Format(Now, "hhmmss") & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
Thanks in advance for any help you can offer.
Thanks, Kenneth. This worked:
If Dir("C:\Temp", vbDirectory) = "" Then
ActiveWorkbook.SaveAs Filename:="M:\PO Response Tracking - Temp" & Format(Now, "hhmmss") & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
GoTo Temp
Else
ActiveWorkbook.SaveAs Filename:="C:\Temp\PO Response Tracking - Temp" & Format(Now, "hhmmss") & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
Bookmarks