Can I call a static method of a C# class from VBA via COM?
问题 If I define a class in a C#/.NET class library, then by making it COM visible I can instantiate the class and call its methods from VBA using COM. Is there any way to call the static methods of such a class from VBA? 回答1: COM does not support static methods, and instances of COM objects do not invoke static methods. Instead, set ComVisible(false) on your static method, then make an instance method to wrap it: [ComVisible(true)] public class Foo { [ComVisible(false)] public static void Bar() {