0

I have added a reference to Microsoft.Office.Interop.Word 12.0.0.0. I have Visual Studio 2008 and Microsoft Word 2010(Starter).

string filePath = @"C:\PP.docx";
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.ApplicationClass();

// create object of missing value
object miss = System.Reflection.Missing.Value;

// create object of selected file path 
object path = filePath;

// set file path mode 
object readOnly = false;

// open document                 
Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);

// select whole data from active window document
docs.ActiveWindow.Selection.WholeStory();

// handover the data to cllipboard 
docs.ActiveWindow.Selection.Copy();

// clipboard create reference of idataobject interface which transfer the data
System.Windows.Forms.IDataObject data = Clipboard.GetDataObject();

I get the error mentioned below:

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154. at Microsoft.Office.Interop.Word.Application word => new Microsoft.Office.Interop.Word.ApplicationClass();

Thanks, Sachin K

Bridge
  • 29,818
  • 9
  • 60
  • 82
sachin kulkarni
  • 2,618
  • 7
  • 28
  • 33
  • Have you seen this related question? It could be a 64bit issue http://stackoverflow.com/questions/1036856/retrieving-the-com-class-factory-for-component-with-clsid-xxxx-failed-due-to-t – Kevin Main Jun 21 '12 at 10:59
  • @KevinMain - Your comment does not make sense. The `Microsoft.Office.Interop.Word 12.0.0.0` support x64 assemblies. Office 2010 in general support x64 platforms. – Security Hound Jun 21 '12 at 11:31
  • @Ramhound Very good point, didn't really think that through! – Kevin Main Jun 21 '12 at 11:47
  • I am currently developing the application on 32 bit.Laptop.Current scenario deals with VS.Net 2008 with Higher Version of Ms Office-2010.Is that angle also to be considered. – sachin kulkarni Jun 22 '12 at 05:55

1 Answers1

1

The Office Starter 2010 edition is limited and does not support automation.

You need to get an appropriate full Office suite (e.g. the Professional edition).

For more information about the limitations see http://www.microsoft.com/oem/en/products/office/pages/office_2010_starter.aspx

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316