thankgodfortektips
Programmer
Guys,
I have been looking at this all damn day... I have 2 sets of code that kind of work. I have one that open a rtf file and the next that loops through docVariables. The docVariable is the preferred method because the user needs .doc not .rtf.
here is the code...
************************************
Set WordApp = Server.CreateObject("Word.Application")
Set WordDoc = Server.CreateObject("Word.Document")
Set WordDoc = WordApp.Documents.Open("D:\doc1.doc")
With WordDoc
.Variables("strSurname").Value = "test1"
.Variables("strMaidenName").Value = "test2"
'On Error Resume Next
.Fields.Update
.SaveAs "D:\test1.doc"
.Close
'On Error Goto 0
End With
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
*******************************
This code is working apart from the fact that when I load test1.doc I have to go to the field and right click on it and say update field... I would think that .fields.update would do this for me... Anyone any ideas?
thanks!
I have been looking at this all damn day... I have 2 sets of code that kind of work. I have one that open a rtf file and the next that loops through docVariables. The docVariable is the preferred method because the user needs .doc not .rtf.
here is the code...
************************************
Set WordApp = Server.CreateObject("Word.Application")
Set WordDoc = Server.CreateObject("Word.Document")
Set WordDoc = WordApp.Documents.Open("D:\doc1.doc")
With WordDoc
.Variables("strSurname").Value = "test1"
.Variables("strMaidenName").Value = "test2"
'On Error Resume Next
.Fields.Update
.SaveAs "D:\test1.doc"
.Close
'On Error Goto 0
End With
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
*******************************
This code is working apart from the fact that when I load test1.doc I have to go to the field and right click on it and say update field... I would think that .fields.update would do this for me... Anyone any ideas?
thanks!