I have developed a WinForm Application with VB.Net (VS2010) having Office 2010 Professional Installed, and it is 64-bit Windows 7 Platform. The program opens a .doc and .rtf format document, and attempts to save it in htm format. I am using following commands:
Dim sFilePath as String = "C:\ABC\file.doc"
Dim oApp As New Microsoft.Office.Interop.Word.Application
Dim oDoc As New Microsoft.Office.Interop.Word.Document
Dim sTempFileName As String = System.IO.Path.GetTempFileName()
oDoc = oApp.Documents.Open(sFilePath)
oApp.Visible = False
oDoc = oApp.ActiveDocument
oDoc.SaveAs2(sTempFileName, FileFormat:=WdSaveFormat.wdFormatHTML,CompatibilityMode:=Microsoft.Office.Interop.Word.WdCompatibilityMode.wdWord2007)
oDoc.Close()
oApp.Quit()
oDoc = Nothing
oApp = Nothing
All goes fine with development and running on development PC, but when I publish it for offline installation, and deploy it on Client PC having Windows XP with Office 2007, it gives error on oDoc.SaveAs2 line, and program crashes. I have googled enough but could not find a solution to it. Somebody please help me ASAP