View Single Post
 
Old 09-12-2019, 12:05 PM
asdfghjk asdfghjk is offline Windows 10 Office 2016
Novice
 
Join Date: Sep 2019
Posts: 1
asdfghjk is on a distinguished road
Exclamation Outlook VBA: How to return OlColor from property or function?

I have a custom class with a property for OlColor. When I created an instance of this class the color (OlColor) property was set. However when I reference the parameter it returns a Long value rather than the OlColor value. If I watch the class instance in the 'Watches' window the instance shows the color property as type OlColor. However when I pass it in as a parameter to a function VBA is automatically switching it to a Long which causes the other function to fail.

I have also tested this in a simple test function where I set a variable to OlColor in the function and then have the function return the result. Even though the function is set to return OlColor it again is automatically getting converted to Long.

As another workaround I tried using the Long value to set the OlColor, something like OlColor(1), but that doesn't work either.

How can I the either
1. keep OlColor rather than Long
2. use the Long value to reference the OlColor
Reply With Quote