티스토리 뷰






Private Sub Document_Close()


Application.Quit SaveChanges:=wdSaveChanges, OriginalFormat:=wdWordDocument


'ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Exit Sub
   
End Sub


Private Sub Document_Open()

If FileExists("C:\Client\1234.txt") = 1 Then
                       
                        MsgBox "파일 있음 / 내부", vbInformation, "Security Policy"
                    Else
                        MsgBox "파일 없음 / 외부", vbInformation, "Security Policy"
                        Call Document_Close
                    End If
               

End Sub


Function FileExists(ByVal fname As String) As String
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(fname) Then
    FileExists = "1"
Else
    FileExists = "0"
End If
End Function





댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함