Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different methods in different versions

Status
Not open for further replies.

BarryG

Programmer
Nov 19, 1999
23
US
I'm writing a macro in Word that needs to be able to run in Word 97 and Word 2000. However, when it's run in 2000, I need to add a statement that 97 doesn't require. The problem is that the method I need in 2000 doesn't exist in 97 so when I run it in 97 it gives me a compile error "Method or data member not found". My statement looks like this:

Code:
If Application.Version = "9.0" Then Selection.NoProofing = False

The Selection.NoProofing is not available in 97. I've tried On Error Resume Next and On Error GoTo 0 but neither work.
 
Sure...error handling will not work for methods that do not exist. If I understand your question correctly...check for the version of word...

example:

if (application == word2000) then
...
else
...
endif

Hope this helps...
 
DC,

Thanks for your reply. This is what I tried, but the then portion of this statement needs to include the .NoProofing method, which is valid in Word2000 but not in Word97.

What I decided to do is to break this statement out into a function that I call from my main procedure. This way the code doesn't try to compile until the if statement evaluates to true.

Code:
Sub main()
if application.version = "9.0" then
temp = NoProof()
end if
End Sub

NoProof()
Selection.NoProofing = False
End Function

This seemed to work.

Thanks for your suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top