VBA setting document compatibility to the current version

Hi Experts

I am trying to use the following in VBA to make sure the file format of the current document matches the current version (2016) but it errors telling me that the parameter is invalid. Please can someone tell me what I'm doing wrong?

ActiveDocument.SetCompatibilityMode (wdCurrent)

The error is 'one of the values passed to this method or property out of range for this file format'.

If this is not correct, is there another way to achieve this?

Many thanks.
Who is Participating?
Bill PrewConnect With a Mentor Commented:
Are you running this VBA code in Word, or a different office application?

Display the value of wdCurrent and make sure it is 65535.

If it is not set to that, then you can add a constant for it like:

Const wdCurrent = 65535

MonteDelMarAuthor Commented:
Thank you :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.