Dave,
the code you mentioned didn't work, after the "save as" question, it just
stop and does nothing, but..I was able to use some of your codes and I also
removed the Application.Quit...I was able to use this too...myPath =
CreateObject("WScript.Shell").SpecialFolders("DeskTop")...although saving the
file to the path, is now solved, I still get error when choosing No, cancel,
or "X" or when I am prompt that the file already exist and want to override,
yes or no...Below is the code I come up with...I also recorded a macro to
save in the shared drive.
Corey, can you tell me how to use your code?
Application.DefaultFilePath = ("\\Name of Your Server Drive\")
ChDir ("\\Name of Your Drive\")
Here is the new code...
Sub Save_LineAd()
Dim Response As String
Dim msg As String
Dim Style As String
Dim sPath As String
Dim sFilename As String
Dim myName As String
Dim myPath As String
Dim ans
myPath = CreateObject("WScript.Shell").SpecialFolders("DeskTop")
msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2
Response = MsgBox(msg, Style)
If Response = vbYes Then
myName = Worksheets("SHEET1").Range("A2").Value
sPath = myPath & "\My Team\CHR " & myName & "_"
sFilename = Format(Worksheets("SHEET1").Range("A1").Value, "mmddyy")
ans = MsgBox("Save File As " & myName & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs sPath & sFilename
ActiveWorkbook.Close savechanges:=True
Application.StatusBar = "Application Closing."
End If
Else
ActiveWorkbook.Activate
End If
End Sub
Here is the recorded code to save in a shared drive...
Sub
ChDir "Z:\CHR\LineAd\ChrLOB\CSB"
ActiveWorkbook.SaveAs Filename:= _
"Z:\CHR\LineAd\ChrLOB\CSB\CHTR CS Bill_101208.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
..thanks for your help