How to use MS Word automation in WebBrowser Control  
Author Message
omni100





PostPosted: Visual C# Express Edition, How to use MS Word automation in WebBrowser Control Top

Using VS 2005...

Added a Web Browser control to my Windows form and can successfully navigate to a Word doc.

The question is - how do I access the Word object that is displayed on my form. I can do all the Word stuff on the form but I need to access the document programmatically. Basically I need to convert from the HTML document to a Word document.




Visual Studio Express Editions20  
 
 
cverdon





PostPosted: Visual C# Express Edition, How to use MS Word automation in WebBrowser Control Top

Hi,

Look at this thread:

http://www.dotnet247.com/247reference/msgs/55/277921.aspx

Charles


 
 
omni100





PostPosted: Visual C# Express Edition, How to use MS Word automation in WebBrowser Control Top

Thanks for the rapid replay AND ANSWER. I am using .Net 2005 and I am including a code snippet for anyone else who may have a need to do this. I am using Word but it should work for Excel.

Ray

Microsoft.Office.Interop.Word.Application app = null;

try

{

app = (Microsoft.Office.Interop.Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject ("Word.Application");

}

catch (Exception)

{

app = null;

}

if (app == null)

{

app = new Microsoft.Office.Interop.Word.Application ();

app.Visible = true;

}