Guest User

Untitled

a guest
Jan 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Public WithEvents appWord as Word.Application
  2.  
  3. Private Sub appWord_DocumentBeforeSave _
  4. (ByVal Doc As Document, _
  5. SaveAsUI As Boolean, _
  6. Cancel As Boolean)
  7.  
  8. Dim intResponse As Integer
  9.  
  10. intResponse = MsgBox("Do you really want to " _
  11. & "save the document?", _
  12. vbYesNo)
  13.  
  14. If intResponse = vbNo Then Cancel = True
  15. End Sub
  16.  
  17. Public WithEvents App As Word.Application
  18.  
  19. Private Sub App_DocumentBeforeSave _
  20. (ByVal Doc As Document, _
  21. SaveAsUI As Boolean, _
  22. Cancel As Boolean)
  23.  
  24. Dim intResponse As Integer
  25.  
  26. intResponse = MsgBox("Do you really want to " _
  27. & "save the document?", _
  28. vbYesNo)
  29.  
  30. If intResponse = vbNo Then Cancel = True
  31. End Sub
  32.  
  33. Dim X As New EventClassModule
  34.  
  35. Sub Register_Event_Handler()
  36. Set X.App = Word.Application
  37. End Sub
  38.  
  39. Private Sub Document_New()
  40. Register_Event_Handler
  41. End Sub
  42.  
  43. Private Sub Document_Open()
  44. Register_Event_Handler
  45. End Sub
  46.  
  47. Set X.App = Word.Application
  48.  
  49. Set X.appWord = Word.Application
Add Comment
Please, Sign In to add comment