r/visualbasic • • May 11 '20

VB program I am working on

Hello,

I am working on a VB script that can pull out information about tracked changes in Microsoft Word. If you make a change, the script should be able to figure out where (what page) that change occurred. This I have down, and I modified the code below slightly (I did some Google searches, found this great code, then modified it). However, I also want to make it so the revision at which the change occurred also prints. For example, if you make a change to page 4 on Revision 1.1, the script should print a table with "4" in one column, and "1.1" in the column next to it. Conversely, if other changes are made to page 4 but on revision 1.2, it should then print another line that has "4" and "1.2" on it. This is the part I cannot get working. How would you do this?

https://ideone.com/Ed1wfI

5 Upvotes

6 comments sorted by

1

u/andrewsmd87 Web Specialist May 12 '20

I'm not seeing in there where you get the revision number, have you figured that part out yet?

1

u/Popilou1 May 12 '20

That is the part that I need help with. I can get it to print what line the change occurred on, but cannot get it to print what specific revision that change occurred under.

1

u/andrewsmd87 Web Specialist May 12 '20

So having never worked with this, I read up a little so realize I'm kind of shooting from the hip with this suggestion. But, does your oRevision object have a date and/or index property? If I looked up the right thing, I think that would be as close as you could get to some sort of versioning.

I'm not entirely sure what formatting options you have in VBA, but if you can get those two properties, you could make a make shit versioning that would look something like

oRevesion.Date.ToString() & "-" & oRevision.Index.ToString()

Like I said, you may need to format that date, but then you could get something along the lines of

2020-01-01-08:55:55-1

2020-01-01-09:21:34-2

etc.

It would be somewhat informative as it would have the date, plus the index so you would no orders. You could even, tag on oRevision.Author to know who did it. Although, I'm not quite sure what that would actually return.

Let me know if that works, I'm curious now

1

u/andrewsmd87 Web Specialist May 12 '20

Or, if you can send me a sample word doc with what you have going on, I might be able to look at it

1

u/infreq May 12 '20

Does this not fit better in r/VBA?

1

u/Popilou1 May 12 '20

r/VBA

I will try it, thanks.