0
votes

I am using powerbuilder 12.5 to add data to word templates using bookmarks.When I use objword.setformresult(bookmarkname,value) I get run time error 35

"error calling external object function setformresult"

Info: We have recently migrated powerbuilder 6.5 to 12.5 but still we use Office 2003

1

1 Answers

0
votes

This is how I do it:

lole_word = CREATE OLEObject
lole_word.ConnectToNewObject ("word.application")
lole_Document = lole_word.Documents.Open (is_infile,FALSE,TRUE,FALSE)
lole_range = lole_document.Bookmarks.item(ls_bookmark).Range
lole_range.Text = ls_newText                

Always put code like this a Try..Catch block and catch OleRuntimeError and RuntimeError. Note that replacing the text will remove the bookmark. If you need the bookmark you have to remember where it is (for example lole_document.Bookmarks.item(ls_bookmark).Start) and add the bookmark to the document again.