J
JBark
It would be very much appreciated if someone could help me figure out why the
kill statement is not working in this macro. When the button is clicked, it
closes the file but does not delete it from where the file is saved to.
Private Sub CommandButton1_Click()
Dim Doc As Document
Dim DocPathName As String
Set Doc = ActiveDocument
DocPathName = Doc.FullName
'Check that file exists
If Len(DocPathName) > 0 Then
'First remove readonly attribute, if set
SetAttr DocPathName, vbNormal
End If
'Then delete the file
Doc.Close wdDoNotSaveChanges
Kill DocPathName
End Sub
kill statement is not working in this macro. When the button is clicked, it
closes the file but does not delete it from where the file is saved to.
Private Sub CommandButton1_Click()
Dim Doc As Document
Dim DocPathName As String
Set Doc = ActiveDocument
DocPathName = Doc.FullName
'Check that file exists
If Len(DocPathName) > 0 Then
'First remove readonly attribute, if set
SetAttr DocPathName, vbNormal
End If
'Then delete the file
Doc.Close wdDoNotSaveChanges
Kill DocPathName
End Sub