msoPropertyTypeString throwing error in vba as an undefined variable -

I've used a macro for years that includes the start:

Sub WriteProp(sPropName As String, sValue As String, Optional lType As Long = msoPropertyTypeString)

It just started (last week or so) throwing an error that msoPropertyTypeString is an undefined variable.

I do not pretend to understand the macro any more, if I ever did. It came from here.

I replaced msoPropertyTypeString with 4 and it now works.

I am trying to figure out what happened that this constant is no longer defined when used in vba.


It works fine for me in Office 365.

Check if your VBA Reference for Office 16 Object Library is marked.

Richard V. Michaels
Provides free AuthorTec add-ins for Mac & Win-Office. Site:

1 person found this reply helpful


Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.


Question Info

Last updated October 5, 2021 Views 91 Applies to: