Run Active Object : Word « Office « C# / C Sharp






Run Active Object

/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
 */
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Word;

namespace Client.Chapter_19___Office_Integration
{
  public class RunActiveObject
  {
    [STAThread]
    static void Main(string[] args)
    {
      Word._Application MyWord = (Word._Application)Marshal.GetActiveObject("Word.Application");

      MyWord.PrintPreview = true;
      System.Windows.Forms.Application.Run();
    }
  }
}

           
       








Related examples in the same category

1.Modify Word Document Properties
2.Create Word CommandBars