PDA

View Full Version : Is there a text change event for Word?



manishbaba
10-24-2007, 11:12 AM
Hi,

I know this question might have asked several times but I would like to know if there is any event exisiting to capture text change or deletion in MS Word.

I am trying to track changes using VB..but couldn't find a code to handle it.

Thanks,
Manish

TonyJollans
10-24-2007, 11:44 AM
The short answer is no. The closest you can get is the Application WindowSelectionChange. Deleting text does trigger it, backspacing doesn't. Typing doesn't trigger it and there are a few odd things that don't trigger it but it's quite hard to do an awful lot of work without doing something that does trigger it.

To do better you need to use APIs to catch keypresses.

manishbaba
10-24-2007, 12:57 PM
Can anybody please help me in getting track changes done through VBA in Word document?

TonyJollans
10-24-2007, 01:52 PM
What is the problem with using the Track Changes capability of Word itself? What are you really trying to achieve?

fumei
10-24-2007, 01:59 PM
Exactly. What is it EXACTLY that you are trying to do?

There is a Track Changes feature in Word that, well, track changes. It does it right in the GUI, that is, the changes are shown visually.

You are going to have to clearly state what: "getting track changes done" actually means.

manishbaba
10-24-2007, 02:17 PM
Exactly. What is it EXACTLY that you are trying to do?

There is a Track Changes feature in Word that, well, track changes. It does it right in the GUI, that is, the changes are shown visually.

You are going to have to clearly state what: "getting track changes done" actually means.

User doesn't want to use inbuilt tracking feature because word pops up all the comments in that little bubble box. So if there are 100 changes, there will be 100 little icons all over the document. User wants a cleaner solution where they mouse hoover the changed/modified text then only they should see the pop-up dispalying the complete history trail like who, when, what got modified.

Hopefully I explained the problem.

OTWarrior
10-25-2007, 04:22 AM
The only way I can think of that would show you what has changed, woudl be to bookmark every sentance/paragraph, and save the results on document load. Then when a change occurs, if the paragraphs are changed, to display the difference.

to the best of my knowledge, the main problems you would face are you would have to have it on a timer to constantly check the whole document (slow) or to have a button on a menu or toolbar which checks every section (requires the user to always press the button), or to track a certain key press (such as the return key, but it would have to be a key the user will deffinately use at the end of their changes)

Sorry I can't be of more help, but I can't really see a way of tracking the changes other than using the in-built function.

fumei
10-25-2007, 01:09 PM
Yes, you explained the situation better.

"User wants a cleaner solution where they mouse hoover the changed/modified text then only they should see the pop-up dispalying the complete history trail like who, when, what got modified."

Tell the user.....no, that is not possible. For one thing, there is no mouse over event.

woudl be to bookmark every sentance/paragraphNot only sentence/paragraph, but it seems every word as well!

Tell the user....no, it is not possible. The values (history etc.) are part of Track Changes, and it is either ON, or OFF.

If it is ON, then you have all those comment boxes. If it is OFF, there are none. There are no pop-ups.

Word has no way of knowing if something is changed unless Track Changes is ON. If it is ON, then you have those comments boxes.

End of story.

Trying to constantly check bookmarks is insane.

This is a sentence.

Bookmark # 1 - This is a sentence.

User changes This to That. OK. Now what. There is NO change event - unless you have Track Changes ON.

Running code to check the bookmark will not work, because any change in the bookmark now becomes that bookmark text, and Word has NO idea that is different from the text it used to be.

Not unless you actually stored the text into an array/variable. In other words, you would essentially be creating a parallel document. AND, if you wanted history, and who did it....MORE data in variables.

THEN if there are multiple changes:

This is a sentence. text = value # 1, date = value #2, user = value #3
That is a sentence. text = value # 4, date = value #5, user = value #6
This is a sentence. (Changed back) text = value # 7, date = value #8, user = value #9

And on and on and on. That is just one sentence with three changes. You want to make something effective over a document?

Tell the user.....no.

TonyJollans
10-27-2007, 08:09 AM
Seconded - tell the user it can't be done.

It might be possible - with a huge amount of effort - to maintain a record of changes made by edit session and store them somewhere (not easily in the document, though) and then maybe make them available via a right click menu or something but it wouldn't be what they wanted and it wouldn't be as good as the built-in change tracking.

So tell them it can't be done.

fumei
10-29-2007, 08:19 AM
A HUGE HUGE amount of effort. And that is no exaggeration.