473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Late Binding and Invoke

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("DisableAutoMacro s",
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("DisableAutoMacro s",
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
Nov 16 '05 #1
0 1241

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: PJ | last post by:
Hello, I am trying to use late binding to call a COM object. I am trying to call a 'GetTables' method on the object. It's essentially a 'MetadataService' which is used to return the names of...
2
by: Mystery Man | last post by:
We are developing a C# application that has many interfaces to the Microsoft suite (eg Word, Excel, Outlook, Powerpoint, etc). We need to support Office 97, 2000, 2002 and any future versions. ...
0
by: Matt | last post by:
I'm trying to use late binding to automate Excel from C# so as to run with multiple versions of Excel, and am hoping to avoid referencing any Excel PIA in my project. But I need to add a C# event...
5
by: Daniel Bass | last post by:
..Net is great for modulerising libraries, so that all you need do to access a DLL, is simply call Add Reference and wallah, it's as though the library were written in your project. But what...
9
by: Scott English | last post by:
I am writing an C# program. I call a method on a COM object that returns Object. I don't know the type of the object (and reflection just says its a __ComObject), but I know there is supposed to...
1
by: Jim | last post by:
Hey all I'm trying to late bind a VB6 object in Component Services using c#. I've been able to do tons of late binding, but now that I have a com+ object that doesn't have a method exposed...
5
by: CodeRazor | last post by:
How can i load an interface from a dll using System.Reflection? I can see how its possible to do this on methods, properties in a class. You create an instance of the class and use the invoke...
0
by: Rocio | last post by:
Here I go again. Some time ago I wrote a VB.NET web service application that called a COM object written in VB6 using late binding. It was the only way I could call this object (see my posting in...
7
by: Entwickler | last post by:
hello, i have the following problem. i want to write a code that enables the user to call functions from a unmanaged code .dll at running time . so i have to use the late binding . i tried the...
1
by: nelsonivan | last post by:
Hi, i'm trying to reference some objects using reflection and Late Binding accessing. The Object API to his methods it's easy to understand, and it's as "Object.Method" - aka....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.