View Single Post
 
Old 09-03-2015, 07:44 PM
Guessed's Avatar
Guessed Guessed is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,161
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Writing VBA code is no different between those versions of Word. I can't see anything in your provided code that would act differently on versions of Word from 2003 to 2013. However, you could certainly improve the code to make it much clearer what is going on.

I suspect the problem you are seeing is because you are running the find and not actually testing to see whether it found anything (and moved the selection as a result) before doing the second part of the macro. Then the subsequent code would give wildly different results depending on the content above the found text (eg moving by two lines is different to moving by two paragraphs). If you test the macro on different files you will get different results but the version of Word appears irrelevant to your issue.

Perhaps you should explain what you want the macro to do so we can provide handwritten code that is a lot more error tolerant than what you recorded. You say you want to add the time but your code doesn't do that.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote