PDA

View Full Version : Documentation online for VBA method changes from Word 2003 to 2007 to 2010?



ravl13
04-03-2015, 06:03 AM
Hello,

I have some vba old code, that assumes users are using Word 2003. Users will soon be using Word 2007 or 2010 (not sure which at this point), but I've seen that certain vba methods meant for Word will fail when Office 2007 is being used. For example, in the below code:



Set mWord = StartWord()


Set mActiveDoc = mWord.Documents.Add
Set mSelection = mWord.Selection
mWord.Visible = True
mSelection.Find.Execute

mSelection.InsertFile "\\**Template Directory Here**\Roster Template.doc"
'-
'- This code is specific to the version and patch release of Word
'- research has to be done to find a method that will function correctly
'-
mSelection.GoTo wdGoToLine, wdGoToFirst
mSelection.Find.Execute "%Course%", , , , , , , , , rs("Title"), True
mSelection.GoTo wdGoToLine, wdGoToFirst
mSelection.Find.Execute "%CityState%", , , , , , , , , ClassLocation, True


The lines bolded will fail if using Word 2007, but will succeed if using Word 2003.

Does anyone know of an online resource that details these these kinds of differences between versions of Microsoft Word (2003, 2007, 2010)? Basically, something that I could look at and see "This is how it used to work in Word 2003, and this is how it works now in Word 2007".

I'm not just looking for a this mSelection.Find.Execute behavior change specifically - I'm sure I'll need to check out other methods as well later on.