E_FAIL calling CommandBars.ExecuteMso() on Chinese machine

52 views
Skip to first unread message

Gareth Hayter

unread,
Mar 7, 2022, 11:27:33 PM3/7/22
to Excel-DNA
I've got an issue where calling CommandBars.ExecuteMso(msoName) on a system where the input language is Chinese throws an E_FAIL exception. As can be seen here, this is because the string specified in msoName cannot be found or is invalid.

In my instance, the msoName values are "EquationInsertNew" and "EquationProfessional". A full list of possible values can be seen here.

I've tried converting the string to CultureInvariant, en-US and CurrentCulture, but it is not working.

Any ideas how to call ExecuteMso when the system input is Chinese?

Govert van Drimmelen

unread,
Mar 8, 2022, 3:51:01 PM3/8/22
to Excel-DNA
Hi Gareth,

Rather than trying to convert the string, you might need to experiment with setting the thread culture before making the call.

-Govert
Reply all
Reply to author
Forward
0 new messages