Results 1 to 2 of 2

Thread: [2.0] Select All in Winword

Threaded View

  1. #1

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    [2.0] Select All in Winword

    Hi all,
    I am using this code, to open a word document using Latebinding.Can any one help to copy the contents of the opened document to clipboard.

    Code:
            private void button2_Click(object sender, EventArgs e)
            {
                object WordApp;
                object WordDoc;
                object Doc;
                ArrayList nFile=new ArrayList();
                Object[] objFalse = new Object[1];
                objFalse[0] = true;
                object[] nfilename=new object[1];
                nfilename[0]= @"c:\abe.DOC";
                Type objClassType = Type.GetTypeFromProgID("Word.Application");
                WordApp = Activator.CreateInstance(objClassType);
                objClassType.InvokeMember("Visible", System.Reflection.BindingFlags.SetProperty, null, WordApp, objFalse);
                WordDoc = WordApp.GetType().InvokeMember("Documents",System.Reflection.BindingFlags.GetProperty, null, WordApp, null);
                Doc = WordDoc.GetType().InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, WordDoc, nfilename);
                Object WordView = WordApp.GetType().InvokeMember("View", System.Reflection.BindingFlags.InvokeMethod, null, WordDoc, null);
    }
    Thanks in Advance
    Dana
    Last edited by danasegarane; Oct 17th, 2007 at 06:49 AM.
    Please mark you thread resolved using the Thread Tools as shown

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width