How to set the ActivePrinter Property for Microsoft.Office.Interop

  • Thread starter Thread starter Vinu
  • Start date Start date
V

Vinu

I've created the Microsoft.Office.Interop.Excel.ApplicationClass instance
using following code.

theServer = Activator.CreateInstance(ServerType);

private static Type ServerType { get { return
Type.GetTypeFromProgID("Excel.Application"); } }
Type typeof_Server = theServer .GetType();
typeof_Server.InvokeMember("ActivePrinter", BindingFlags.SetProperty, null,
theServer ,new object[] { "MyPrinter on Ne03:" });

I'm not able to set printer property for this instance using the above code.
It gives an exception unable to set the ActivePrinter Property for the
ApplicationClass.

In MSDN the ActivePrinter property for
Microsoft.Office.Interop.Excel.ApplicationClass instance has following
description.
public virtual string ActivePrinter {get; set;}This property supports the
..NET Framework infrastructure and is not intended to be used directly from
your code.

How do i set it.

Thanks
Vinu
 
Back
Top