I do a search and replace in word documents without problem at all.
Now I need to change some 'combination fields' , there's no posibilitty to create a new ones, I must use some given by my client, which they use in another proceses.
The problem is , I can't replace <<FIELD>>.
In some way, my routine doesn't find it, nor change it.
Code: Select all
...
oDoc = oWord:Documents:Open(MODELO)
oDoc:Select()
oSel = oWord:Selection
WordReplace( oSel, "«fecha»" , Alltrim(oDbSel:DATA01))
....
FUNCTION WORDREPLACE( oSel, cSrc, cRpl )
LOCAL oRepla:= oSel:Document:Content
IF AT( cSrc, oRepla:Text ) = 0
RETURN .F.
ENDIF
WHILE oRepla:Find:Execute( cSrc )
oRepla:Text = cRpl
oRepla:Collapse( 0 )
ENDDO
RETURN .T.
Any help will be appreciated.
From Chile
Adolfo