D
Dominic
Hi,
I'm tring to call the DisableAutoMacros method (well I think it's a
method) of the Word.WordBasic object.
This is returned as a _ComObject so I can not access this method
directly.
I have tried the following:
Word.Application MSWord = new Word.ApplicationClass();
object WordBasic = MSWord.WordBasic;
WordBasic.GetType().InvokeMember("DisableAutoMacros",
BindingFlags.Static | BindingFlags.Public |
BindingFlags.InvokeMethod, null,
WordBasic, new object [] {});
or
object MSWord = Activator.CreateInstance(t);
object WordBasic = MSWord.GetType().InvokeMember("WordBasic",
BindingFlags.Static | BindingFlags.Public |
BindingFlags.InvokeMethod, null, MSWord, new object [] {});
WordBasic.GetType().InvokeMember("DisableAutoMacros",
BindingFlags.Static | BindingFlags.Public |
BindingFlags.InvokeMethod, null,
WordBasic, new object [] {});
This gives a Exception of :
Exception has been thrown by the target of an invocation.
with an inner Exception of :
Member not found.
If I change the call from "DisableAutoMacros" to something else like
"DisableAyutoMacrossss" I get the exception :
Unknown name.
I assume it can find DisableAutoMacros due to the different execption
messages but I still can't find a way of calling it.
Any help would be most apprecated.
Dominic Godin
I'm tring to call the DisableAutoMacros method (well I think it's a
method) of the Word.WordBasic object.
This is returned as a _ComObject so I can not access this method
directly.
I have tried the following:
Word.Application MSWord = new Word.ApplicationClass();
object WordBasic = MSWord.WordBasic;
WordBasic.GetType().InvokeMember("DisableAutoMacros",
BindingFlags.Static | BindingFlags.Public |
BindingFlags.InvokeMethod, null,
WordBasic, new object [] {});
or
object MSWord = Activator.CreateInstance(t);
object WordBasic = MSWord.GetType().InvokeMember("WordBasic",
BindingFlags.Static | BindingFlags.Public |
BindingFlags.InvokeMethod, null, MSWord, new object [] {});
WordBasic.GetType().InvokeMember("DisableAutoMacros",
BindingFlags.Static | BindingFlags.Public |
BindingFlags.InvokeMethod, null,
WordBasic, new object [] {});
This gives a Exception of :
Exception has been thrown by the target of an invocation.
with an inner Exception of :
Member not found.
If I change the call from "DisableAutoMacros" to something else like
"DisableAyutoMacrossss" I get the exception :
Unknown name.
I assume it can find DisableAutoMacros due to the different execption
messages but I still can't find a way of calling it.
Any help would be most apprecated.
Dominic Godin