I have made a Word Template with Bookmarks and an application that writes to the bookmarks with data from the app. I have Word 2003 installed on my system. After creating the setup and installing it on another system the App crashed, I then noticed the other system has XP installed. So here is my question, is there a way to create an app that write data to bookmarks within Word that is independant of the version of Word being using? I will need to it work on systems with Word 2000, XP or 2003 installed.
I tried some test code, trying to make it work but was not successful, only works with the version of Word installed on my system. Here is the test code I used...
Dim WordApp As New Word.Application
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ReportGenerator As New Word.Document
ReportGenerator = WordApp.Documents.Open("C:\Report Generator\Demo.doc")
With ReportGenerator
If Len(txtName1.Text) > 0 Then
.Bookmarks("Name1").Select()
WordApp.Selection.TypeText(txtName1.Text)
End If
If Len(txtName2.Text) > 0 Then
.Bookmarks("Name2").Select()
WordApp.Selection.TypeText(txtName2.Text)
End If
.Close(Word.WdSaveOptions.wdSaveChanges)
End With
WordApp.Quit()
Thanks


Reply With Quote
