before-save

Word VBA - DocumentBeforeSave event?

人走茶凉 提交于 2019-11-29 12:58:35
I am using the following VBA code to make a message box appear while saving the Word document, Public WithEvents appWord as Word.Application Private Sub appWord_DocumentBeforeSave _ (ByVal Doc As Document, _ SaveAsUI As Boolean, _ Cancel As Boolean) Dim intResponse As Integer intResponse = MsgBox("Do you really want to " _ & "save the document?", _ vbYesNo) If intResponse = vbNo Then Cancel = True End Sub This code was written in a Class. But this does not work. Nothing happens when saving. What is the issue here? Codename K I made it to work. Thanks to AnalystCave.com for the help. This is

Word VBA - DocumentBeforeSave event?

这一生的挚爱 提交于 2019-11-28 06:11:52
问题 I am using the following VBA code to make a message box appear while saving the Word document, Public WithEvents appWord as Word.Application Private Sub appWord_DocumentBeforeSave _ (ByVal Doc As Document, _ SaveAsUI As Boolean, _ Cancel As Boolean) Dim intResponse As Integer intResponse = MsgBox("Do you really want to " _ & "save the document?", _ vbYesNo) If intResponse = vbNo Then Cancel = True End Sub This code was written in a Class. But this does not work. Nothing happens when saving.

How to “update_attributes” without executing “before_save”?

安稳与你 提交于 2019-11-27 14:29:32
问题 I have a before_save in my Message model defined like this: class Message < ActiveRecord::Base before_save lambda { foo(publisher); bar } end When I do: my_message.update_attributes(:created_at => ...) foo and bar are executed. Sometimes, I would like to update message's fields without executing foo and bar . How could I update, for example, the created_at field (in the database) without executing foo and bar ? 回答1: In rails 3.1 you will use update_column. Otherwise: In general way, the most