Does anyone know how to write an ASP.NET/VB.NET web site that opens MS Word on the client's machine? In the ASP.NET web application that I'm writing, the user selects a Word document from a listbox. The user clicks a button to open the selected document and at the same time, special text strings are substituted into the Word document. Here is code that launches MS Word on the server but I need to launch Word on the client machine.
Dim myWordApp As Microsoft.Office.Interop.Word.Application = New Microsoft.Office.Interop.Word.Application
Dim myWordDoc As Microsoft.Office.Interop.Word.Document = New Microsoft.Office.Interop.Word.Document
Dim strDocToOpen As String = "\\sharefolder.mycompany.com\data\mydocument.doc"
myWordApp.Visible = True
myWordDoc = myWordApp.Documents.Add(strDocToOpen)
myWordDoc.Content.Find.Execute(FindText:="@ANYSTRING", ReplaceWith:="NEWSTRING", Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll)
This is code that's in WEB.CONFIG (for using Interop):
<
system.web><compilation defaultLanguage="vb" debug="true" explicit="true"><assemblies><add assembly="Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/></assemblies></compilation>
Tks!