Notification about any changes in document

A

Alex

How can I send a notification about any changes in a document?
I think, it should be some after_update event but I don't know how I can
apply it to the Word document.

In addition, how I can assign the name of the changed document to strWordFile?

DoCmd.SendObject acSendReport, "rptNotofy", acFormatRTF, "Alex", , , _
"Some changes done in " & strWordFile, _
"Notification about changes done", False

Thanks in advance
 
J

Jonathan West

Is this supposed to be when you save the document, or whenever the user
types in a new character?

Are you wanting to work with all documents on the computer or just a certain
document or set of documents?
 
A

Alex

Thanks for your response, Jonathan.

I'd like to be able to send this notification whenever the user makes any
changes in the document.

It's just a certain Word documents in some folder. It would be better to
have a name of the document in the notification. ... "Some changes done in "
& strWordFile, ...

Probably, it should be AfterUpdate event but applyed to the whole word
document, and I don't know how and where to put that code below.

If it was an MS Access form I could insert the code into Form_AfterUpdate().
How about MS Word?

Thanks
 
A

Alex

Sorry, Jonathan, I didn't mention that of course those changes should be
saved to have a reason to send the notification.
 
J

Jonathan West

Alex said:
Sorry, Jonathan, I didn't mention that of course those changes should be
saved to have a reason to send the notification.

If you are using Word 2000 or later, you can use the DocumentBeforeSave
event of Word's application object. The code in the event would need to
check what document was being saved (perhaps using the
ActiveDocument.FullName property), and send the notification if appropriate.

The following article provides code samples for using Word's Application
event procedures

Writing application event procedures
http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm
 
B

Basavaraj

Hi,
How can we get this event notification if we want to use connection point
mechanism..? i mean, if we dont use VBA and use C and C++ instead, we can
hook on to these events though connection points. Can you explain me a bit if
you have any idea about this..? thanks in advance.
 
J

Jonathan West

Basavaraj said:
Hi,
How can we get this event notification if we want to use connection point
mechanism..? i mean, if we dont use VBA and use C and C++ instead, we can
hook on to these events though connection points. Can you explain me a bit
if
you have any idea about this..? thanks in advance.

I don't use C or C++, so the syntax of this is not known to me. Word in this
context is a straightforward ActiveX application, and there must be plenty
of information around on how to sink events from an ActiveX source.
 
U

Uwe Reyle

Hi Jonathan,

I wold like to write any changes made to an active document to a file
without closing the active document. Is there a way to do that?

Thanks for any hint
Uwe
 
D

Doug Robbins - Word MVP

Something like:

Dim Source As Document
Dim Target As Document
Dim arev As Revision
Set Source = ActiveDocument
Set Target = Documents.Add
With Source
For Each arev In Source.Revisions
Target.Range.InsertAfter arev.Type & vbTab & arev.Range.Text & vbCr
Next arev
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
U

Uwe Reyle

Dear Doug,

Thank you very much. That was very helpful.

But I have a further question:

Is it also possible to print the localization of the change in the (original
or modified) document (i.e. something like: 'second paragraph, 17th
charachter' or similar)?

Best regards
Uwe
 
D

Doug Robbins - Word MVP

The following would provide the Page and the Line Number

Dim Source As Document
Dim Target As Document
Dim arev As Revision
Set Source = ActiveDocument
Set Target = Documents.Add
With Source
For Each arev In Source.Revisions
Target.Range.InsertAfter arev.Type & vbTab & arev.Range.Text & "
Page " & arev.Range.Information(wdActiveEndPageNumber) & " Line " & _
arev.Range.Information(wdFirstCharacterLineNumber) & vbCr
Next arev
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top