Pixelpusher
Board Regular
- Joined
- Feb 15, 2005
- Messages
- 92
This has been buging me for a few days I realy need to resolve this one.
I have the code below to save the active workbook to a location as a defined name, what I need is to add code to deleat(Kill) the original file and close new saves workbook without a promt.
I have read lots of threads on this but with errors one deleated my file with the macros attached thanks.
'=====================================================
Sub ArcivePDF()
Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(Prompt:="Please check for any empty RED cells.Are you sure you want to save as final CDS [.PDF].'Yes' or 'No'.", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
Dim sPath As String
'Change to CDSARCIVE location.
sPath = "F:\PGregory\EDEC\CDSARCIVE\"
On Error Resume Next
ActiveWorkbook.SaveAs sPath & ActiveSheet.Range("B6").Value & ".xls"
If Err.Number <> 0 Then
MsgBox "File not saved!" & vbLf & "Check if all referance Numbers are Entered"
Err.Clear
End If
Else
' The no button was selected.
MsgBox "You selected 'No'."
End If
End Sub
=====================================================
I have the code below to save the active workbook to a location as a defined name, what I need is to add code to deleat(Kill) the original file and close new saves workbook without a promt.
I have read lots of threads on this but with errors one deleated my file with the macros attached thanks.
'=====================================================
Sub ArcivePDF()
Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(Prompt:="Please check for any empty RED cells.Are you sure you want to save as final CDS [.PDF].'Yes' or 'No'.", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
Dim sPath As String
'Change to CDSARCIVE location.
sPath = "F:\PGregory\EDEC\CDSARCIVE\"
On Error Resume Next
ActiveWorkbook.SaveAs sPath & ActiveSheet.Range("B6").Value & ".xls"
If Err.Number <> 0 Then
MsgBox "File not saved!" & vbLf & "Check if all referance Numbers are Entered"
Err.Clear
End If
Else
' The no button was selected.
MsgBox "You selected 'No'."
End If
End Sub
=====================================================