MS-Word macro/VBscript - Isn't there a way to do this?

Discussion in 'Software' started by scribe, Jun 20, 2004.

  1. scribe

    scribe Private E-2

    Hi All,

    Backround on me: first post (Howdy do!) and many years as a geek just a new Major Geek. Have worked with Word macors and scripts before, but it's been a little while.

    Software: MS-Word 2000

    What I'm trying to do: We receive a file that is in RTF. This file averages 65-75 pages daily. Current procedure is to print entire file, do an eyeball search for the records that don't match, and update our file with new information. There does not appear to be a way to fully automate this due to the software we are using and the capabilities of the people involved. My thought was if we can't automate the entire process, at least automate the matching process and limit the print-out to only those entries requiring action - saving time, toner and paper. The report is so long that it is usually printed out and put into a box with the idea that it will be gotten to when all the other work is done - which is not very often.

    The report has headers and footers - easy part already am getting rid of those.

    Each set of data to match is on two lines. The first line contains what we had for information and the second line contains 'corrected information'. Often-times the two match. These are the ones I want to get rid of. The problem is that while the information to be compared appears on the same place on the printed page, within Word there are two fields at the end of line 1 where there may be 1, both or none listed for each entry and another field often has extraneous tabs in it.

    Here's the question: Is there a way to snag the pieces of info to be compared using some sort of function that relies on the ruler? For example, piece one to compare runs from point A to point B on the ruler; piece two runs from point B+1 to point C, piece three runs from point C+1 to D, and piece four runs from point D+1 to E. A, B, C, D, and E would remain constant every time this file is checked.

    Any ideas?

    regards,
    scribe
     
  2. kkj

    kkj Private E-2

    Hi Scribe,

    does this forum allow you to upload your rtf file? I think you can if you "zip" it first.

    I, too, am recently returning to the concept of VBA macros after several years of not dealing with them.

    I'm sure there is a way to do what you ask, but I'm afraid I don't entirely understand your description of how the file looks and/or how it is laid out.

    could you post a few lines of the rft file somehow? Or if you get really desperate, maybe you and I could set something up so you could email me an actual sample rtf file. Of course, you would definitely want to delete any confidential info (obviously), but you could just put "Company X" or "Mr. X" as placeholders to preserve the appearance of the original.

    Is the info laid out in a table? Also, what exactly do you mean by "field?" A cell in a table? Or the kind of input field things you see in a Word doc when you hit Alt+F9 to show field codes?

    I'm thinking the data is in a table, which should make things easier...
    we could use code like:
    Selection.MoveRight Unit:=wdCell
    and test or compare each successive cell in the table

    Maybe I am extremely dense for not understanding your description, but I promise you that if I ever get a clear vision of the layout of the rtf, I could write a macro that would prove I'm not always dense!

    Best of luck! try to post a visual example, or a file

    Kelly
    http://kellyjones.netfirms.com/visualbasic/myHTMLtidyup.html
     
  3. kkj

    kkj Private E-2

    I had another thought that may or may not help...

    try opening the rtf file in NOTEPAD. it will look very strange, of course, but this may give you a better idea of the underlying structure of the document.

    also, you may actually discover that it would be easier to work with the data as it appears in NOTEPAD (a more "naked" view of the data as compared to viewing it in Word).

    Good luck!
    I remain vigilant for your reply
    Kelly
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds