Platform: Windows and Microsoft Visual Basic 2010 Express
The problem: I have a Word template made in Word 2007. When the application is run in a machine with Word 2010, the SaveAs-command doesn't work. It works fine to open a template and add data and even a photo to bookmarks in the template.
Here is the statement that doesn't work(vPath
contains path and filename.):
oDoc.SaveAs(vPath.ToString)
I have tried different solution but nothing works:
oDoc.SaveAs(vPath.ToString, WdSaveFormat.wdFormatDocument)
oDoc.SaveAs(vPath.ToString, 17) ' WdSaveFormat.wdFormatPDF
oDoc.SaveAs(vPath.ToString, 6) ' WdSaveFormat.wdFormatRTF
References:
- Microsoft Office 12.0 Object Library
- Microsoft Word 12.0 Object Library
Import statements:
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Word