P
Peter W Johnson
Hi Guys,
I have an application written in vb.net that creates and saves a word
document.
We have just upgraded our office package from 2003 to 2007. Consequently our
members are now receiving their documents in 2007 format.
Is there anyway I can programmatically save the document in 2003 format in
my vb.net application?
Some code follows:-
' prepare word document for printing
Dim wrdSelection As Word.Selection
Dim wrdMailMerge As Word.MailMerge
Dim wrdMergeFields As Word.MailMergeFields
' Create an instance of Word and make it visible.
wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Add a new document.
wrdDoc = wrdApp.Documents.Add(*************a suitable template
file*************")
wrdDoc.Select()
wrdSelection = wrdApp.Selection()
wrdMailMerge = wrdDoc.MailMerge()
' Create MailMerge Data file.
Dim wrdDataDoc As Word._Document
' Create a data source at C:\DataDoc.doc containing the field
data.
wrdDoc.MailMerge.CreateDataSource(Name:="C:\DataDoc.doc",
HeaderRecord:="FullName, HomeStreet, HomeCity, HomeState, HomePostCode")
' Open the file to insert data.
wrdDataDoc = wrdApp.Documents.Open("C:\DataDoc.doc")
' Fill DataDoc.doc
' wrdDataDoc.Tables.Item(1).Rows.Add()
FillRow17(wrdDataDoc, (2), FullName, HomeStreet, HomeCity,
HomeState, HomePostCode)
' Save and close the file.
wrdDataDoc.Save()
wrdDataDoc.Close(False)
I am assuming that the "wrdDataDoc.Save()" code saves the document in the
default format. I am trying to save the document in a different format (2003
not 2007)
Cheers
Peter.
I have an application written in vb.net that creates and saves a word
document.
We have just upgraded our office package from 2003 to 2007. Consequently our
members are now receiving their documents in 2007 format.
Is there anyway I can programmatically save the document in 2003 format in
my vb.net application?
Some code follows:-
' prepare word document for printing
Dim wrdSelection As Word.Selection
Dim wrdMailMerge As Word.MailMerge
Dim wrdMergeFields As Word.MailMergeFields
' Create an instance of Word and make it visible.
wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Add a new document.
wrdDoc = wrdApp.Documents.Add(*************a suitable template
file*************")
wrdDoc.Select()
wrdSelection = wrdApp.Selection()
wrdMailMerge = wrdDoc.MailMerge()
' Create MailMerge Data file.
Dim wrdDataDoc As Word._Document
' Create a data source at C:\DataDoc.doc containing the field
data.
wrdDoc.MailMerge.CreateDataSource(Name:="C:\DataDoc.doc",
HeaderRecord:="FullName, HomeStreet, HomeCity, HomeState, HomePostCode")
' Open the file to insert data.
wrdDataDoc = wrdApp.Documents.Open("C:\DataDoc.doc")
' Fill DataDoc.doc
' wrdDataDoc.Tables.Item(1).Rows.Add()
FillRow17(wrdDataDoc, (2), FullName, HomeStreet, HomeCity,
HomeState, HomePostCode)
' Save and close the file.
wrdDataDoc.Save()
wrdDataDoc.Close(False)
I am assuming that the "wrdDataDoc.Save()" code saves the document in the
default format. I am trying to save the document in a different format (2003
not 2007)
Cheers
Peter.