PDA

View Full Version : Track Changes or Black Line?



benz360
04-12-2007, 11:34 AM
Hello,

This is only my second time posting here and I'm pretty new with this so
bare with me.

I have a userform which a user opens that contains different text boxes
linked back to bookmarked - cells in a table. It works fine except when I
track changes it highlights the whole entire bookmarked area and says it was
deleted. When I "accept all changes" only deletes the words/characters I
originaly deleted. The problems is when other users go in to review it looks
like very thing is going to be deleted. The code im using for the textboxes
is below and I've tried the that turns track changes on or off but it still
does the same thing.

Private Sub Summary1()
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks("SummaryOfBP").Range
ROBP_Sum.Text = BMRange.Text
End Sub

Private Sub ROBP_Sum_Change()
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks("SummaryOfBP").Range
BMRange.Text = ROBP_Sum.Text
ActiveDocument.Bookmarks.Add "SummaryOfBP", BMRange
ActiveDocument.TrackRevisions = True
End Sub


Thank you for your help,

Ben Z.:doh:

lucas
04-12-2007, 11:50 AM
What if you use this in the thisdocument module....it will run when the document is closed each time.
Private Sub Document_Close()
ActiveDocument.TrackRevisions = False
End Sub

benz360
04-12-2007, 11:56 AM
It is still saying that everything is being deleted.

lucas
04-12-2007, 11:57 AM
could you post a sample document?

benz360
04-12-2007, 12:36 PM
It says I don't have a high enough post count. Did I do it incorrectly?

benz360
04-12-2007, 12:37 PM
It says I don't have a high enough post count. Did I do it incorrectly? - I used the hyperlink/globe icon.

benz360
04-12-2007, 12:45 PM
.

lucas
04-12-2007, 12:50 PM
Hit post reply on the lower left of the screen.....scroll down after that loads and look for manage attachments.

lucas
04-12-2007, 12:50 PM
You may have to zip it up if its large.

benz360
04-12-2007, 12:51 PM
:banghead: Ok now I've Got it!

lucas
04-12-2007, 05:28 PM
Hi Benz,
I got your pm but I am sadly not going to be much help on this as I am leaving in the morning for a 2 week visit with my oldest son and he is getting married while we are there so I'm a little busy.

I'm pretty sure some help will come along soon. Be patient and don't give up. There are some good people here and sooner or later one will drop by to see what's up.

fumei
04-13-2007, 12:04 AM
I know this is new to you, so I am (really!) trying to be easy.

I have so many issue with this, beyond your track change issue.

1. Your userform is HUGE. This is poor design. I can not even fit it on my screen. I see no reason for such gigantic textboxes.

2. Your userform does not have a single command button. This is VERY poor design. Do not do this.

3. You are not using Option Explicit. I strongly recommend you start...now.

4. It has no explanations to the user.

Further, I am quite distracted by the spelling in the document. Um, I know this is clearly a test document, but as there is not all that much text to begin with, I find it distracting to have spelling mistakes. Especially in a document that appears to deal with communications.

As the userform is so gigantic that I could not actually work with it. I had to essentially rebuild it.

You have no way OUT of the userform! There is no unloading. Bleeech. This is very messy.

OK. As for the track changes. Here is your code again:Private Sub Summary1()
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks("SummaryOfBP").Range
ROBP_Sum.Text = BMRange.Text
End Sub

Private Sub ROBP_Sum_Change()
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks("SummaryOfBP").Range
BMRange.Text = ROBP_Sum.Text
ActiveDocument.Bookmarks.Add "SummaryOfBP", BMRange
ActiveDocument.TrackRevisions = True
End Sub

First of all, what fires the Sub Summary1? I can not see anything.

In any case, you are bringing in text from the bookmark, and putting it in the textbox. Then you are making textual changes to only parts of it HOWEVER, as far as Word is concerned, when you put the textbox contents into the bookmark, and re-add it (which you must do)....it is a whole new chunk of text. Word has no, zero, memory of what was there before.

Therefore, quite validly and correctly, the whole thing is marked as deleted. It IS deleted!

The fact that some of the characters (text) - or even all of it - are the same characters (text) as the original text is totally irrelevant. The fact there there is now a bookmark that is the same name as a bookmark...that no longer exists...means that the original text from that now non-existant bookmark...is completely irrelevant. From Word's perspective the entire bookmark text was removed (along with the bookmark!), and new bookmark, and text, is inserted.

And it was.

What I am saying is:
When I "accept all changes" only deletes the words/characters I originaly deleted. is incorrect.

It did not only delete what you deleted. It deleted everything...YOU put some of the original stuff back in. The Track Changes actions are in order, and correct.

lucas
04-13-2007, 05:28 AM
Hi Gerry,
I had the same issue with the size of the userform and I have a fairly large screen with 1024 res....

just passing by here this morning on my way out of town but read your post....I also coudn't figure out what was calling Summary1 so I searched the entire project and found the call in the combobox....
Private Sub Topics_Combo_Change()
If Topics_Combo.Text = "Communications" Then
MultiPage1.Visible = True
Summary1
Else
MultiPage1.Visible = False
End If
End Sub
Just an FYI

benz360
04-13-2007, 09:43 AM
Hi Gerry,

First off thank you for pointing out the poor design issues - as I said im new and need to learn the correct way of doing things. It is a test doc so most of the information was removed so I could post it. The text boxes are so large because in each bookmarked section there will be multiple bullets with large amounts of text.

I guess it comes down to is there any code I can do that will change the textbox text and the data in the word document simultaneously allowing to track and classify specific changes to individual words or characters not just the bookmarked "chunk" ?

I thought maybe it would be possible to use character count and then possibly, revtype = "Deleted" ? Or is there code for legal blackline/compare documents that could be changed?

Do any of these sound even plausible?

fumei
04-14-2007, 05:38 PM
I guess it comes down to is there any code I can do that will change the textbox text and the data in the word document simultaneously allowing to track and classify specific changes to individual words or characters not just the bookmarked "chunk" ?

No, not if you are, in fact, using bookmark chunks.

Does that mean you can not change text in/out of the textbox and document with appropriate track changes?

Actually, you can, but it would be a lot more work. I suggest you sit down and really think about what you want to do.

WHY do you want to bring everything into the textbox? What is the point of this? It seems to be duplicating on a userform what is going on in the document. What is the purpose here?

As for the track changes issue, Track Changes does just that. Therefore if you want it to track just the changes in text, then you have to edit just those changes. Which mean parsing the text intensely.

As a starting point, perhaps you can use the Range text of the table cell, rather than the bookmark. LOT of work, because you would have to (at least in the design you are using):

1. set a string variable of the chunk

2. bring in that variable, and put it in the textbox. (I think this is not a good idea BTW)

3. let the user make changes

4. do a whole bunch of string manipulations to determine specifically what changes have been made - using the string variable as the logic base

5. carefully parse through the original text (NOT the variable) and carefully change the specific words.

I think it could be done. I would never do it. Not unless I could be convinced there was a real business case for it. Maybe there is, but I am very sceptical.