Exposing .NET enums to COM clients{VBScript}
- by Codex
Am trying create of PoC for exposing/invoking various .NET objects from COM clients.
The .NET library contains some classes and Enums.
Am able to successfully access the classes in VBScript but not able to access the Enums.
I know that Enums are value types and hence 'CreateObject' wont work in this case.
But am able to access the same Enum in VBA code.
Questions:
How can I access the enums in VBScript?
Why does the behaviour differ in the two COM clients? If VBA object browser can see the enum, why cant VBScript allow me to create one?
.NET
[ComVisible(true)]
[GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000E")]
public enum Currency
{
GBP = CurrencyConvertorBL.CurrencyConvertorRef.Currency.GBP,
USD = CurrencyConvertorBL.CurrencyConvertorRef.Currency.USD,
INR = CurrencyConvertorBL.CurrencyConvertorRef.Currency.INR,
AUD = CurrencyConvertorBL.CurrencyConvertorRef.Currency.AUD
}
VBA
Private Function ConvertCurrency(fromCurrency As Currency,
toCurrency As Currency) As Double
VBScript ???
Set currencyConvertorCCY = CreateObject("CurrencyConvertorBL.Currency")
Thanks in advance.