PDA

View Full Version : Word 2002 macro help



ZooMomology
03-10-2010, 09:32 AM
Hi. I am super brand new to VBA coding and I wish I understood any of it, but I don't. I have been researching how to do this forever, but I never find exactly what I need or want. I am an editor and as part of my job I need to provide feedback showing changes I made. In the past, before I learned about macros, I would download a job off of a software platform that uses Microsoft word, and before I make a single change, I would copy the entire document into a blank word document, save that file as "pre." Then, I would edit the document and before I upload it, I copy the entire document again into a new document called "post" and then merge "pre" with "post" and name that as a file name that comes from properties. This is so time consuming and cutting and pasting is something I don't like doing because I am always afraid I would make a mistake and paste the wrong text in the work I am uploading.


I am using word 2002 and my computer has Windows XP Home on it.


So, I want to write a macro to do this for me automatically. I am able to make part of it work, but I get stuck on the merge part.

I had done it with 3 macros actually. The 1st one copies, opens new document, pastes and saves as "pre." The 2nd one copies, opens new document, pastes and saves as "post." Is there a more automated way to do this?

I need help with the one that will take the "pre" and merge and compare it with the "post" and then name the merge and compare document as file name and location. The file name comes form the properties and is called "DictationName."

Is this possible? I have a way I am doing it now by using track changes, but the problem is with voice recognition, all changes show (and they all show in same colors), even the prior ones that were made on another person's machine, and it makes it way too confusing for the person receiving the feedback to understand what I changed. I have tried hiding other reviewer's changes, but it is not consistent and some changes don't hide. I have tried so many things and the feedback is just very confusing. This procedure works great when the file is not a voice recognition file and then only my changes show, which is what I need it to do.

Any help would be greatly appreciated and thank you for reading. :help

fumei
03-10-2010, 11:07 AM
In terms of making two copies ("pre" and "post") this is fairly straight-forward. With the document open (Active):Sub MakePrePost()
Dim StartDoc As Document
Dim PreDoc As Document
Dim PostDoc As Document

Set StartDoc = ActiveDocument
Set PreDoc = Documents.Add
Set PostDoc = Documents.Add

PreDoc.Range = StartDoc.Range
PostDoc.Range = StartDoc.Range

PreDoc.SaveAs FileName:=StartDoc.Path & "\" & "Pre_" & _
StartDoc.Name
PostDoc.SaveAs FileName:=StartDoc.Path & "\" & "Post_" & _
StartDoc.Name

End Sub
If the starting document is: c:\whatever\yadda.doc, you end up with

c:\whatever\Pre_yadda.doc
c:\whatever\Post_yadda.doc

Done.

The merging and comparing is a little tougher. If I understand correctly, in fact, the "post" document is NOT going to be the same. So the above is not appropriate. If I understand correctly, you make a "pre" true copy; edit the starting document, and then THAT becomes the "post"

Is this correct?

This is not the same as:

I had done it with 3 macros actually. The 1st one copies, opens new document, pastes and saves as "pre." The 2nd one copies, opens new document, pastes and saves as "post." Is there a more automated way to do this? The above makes two identical copies. The code Iposted does this. if you are making ONE copy - the "pre" - then use the code for just one file. Note that there is NO copying and pasting done.

Ok, hopefully that takes care of that.

The comparing is tricky. How exactly are you doing that? Also, i am not sure what the voice recognition issue is. Is it just that all changes are the same color?

ZooMomology
03-10-2010, 07:41 PM
Ok, I shall try to explain it better.

A file comes in, usually in the name of Local_Job#. This is a file that has been listened to by the person I need to provide feedback to. It shows no changes. In the past, i would make a cop for pre. I then edit it, and make a copy at the end of my edit for post. I then merge pre and post, which provides a marked up copy. I name the marked up copy by the name of the original file Local_whatever the number is for the job # and save to send later to the original person who typed it. Your right, the reason i did the macro in 2 steps is that there is the pre is before the edit, the post is after the edit, so it has to be run at separate times or i would get 2 exact duplicates. I think i can break what you posted above into 2 macros, and change the text to make one for pre and one for post.

My goal is to get the pre and post to compare and merge, and then save that marked up copy as the original file #, so needs to go back to the original active document and pull the job # from the properties of the downloaded file.

The way I am doing it now is I turn track changes on and then all heck breaks loose. It shows every single change she made. Then, after I QA it, it then shows every change I make, making a huge visual mess. If I unclick the check mark in the reviewing panel for the original person who had the file, their changes hide; however, not all their changes hide or when I QA, some of their changes appear to be made by me, when they were not.

Does that make sense?

macropod
03-11-2010, 04:41 AM
Hi ZooMomology,

Is there a reason you can't use just the one document with Word's 'Track Changes' option activated? The following two statements seem to be at odds:

A file comes in, usually in the name of Local_Job#. This is a file that has been listened to by the person I need to provide feedback to. It shows no changes.

I turn track changes on and then all heck breaks loose. It shows every single change she made.
How can the document show changes if, as received, it has none? If indeed there are tracked changes, part of the problem could be that you're trying to edit over the top of existing tracked changes. That can have all sorts of interesting change-tracking effects. Even your duplication & copy/paste routing won't overcome that.

Perhaps, therefore, the first thing you should do when you receive the document is to turn on 'Track Changes', accept all existing changes, then start your editing. That way, the document you end up with will be a compilation of the 'finalised' document you received plus your tracked edits.

ZooMomology
03-11-2010, 05:08 AM
When the file gets to me, track changes are turned off, so the page has just text on it, but I turn them back on so that I can track my changes, and turning track changes on then shows all the original changes, in addition to the ones I make as I edit the file.

I never thought of accepting all changes before I edit, as I thought that would turn track changes off.

I am going to try that and see what the results are. That would be incredibly wonderful if it works.

Thank you!

ZooMomology
03-11-2010, 05:35 AM
OMG, preliminarily, your suggestion works perfectly. I thank you so much. I would have never ever thought of that. Of course, I will test it with a few documents to make sure the results are what I want, but it seems to be doing exactly what I wanted.

You so rock!!!!

macropod
03-12-2010, 11:51 PM
Glad to be of service.

Have a nice day.