#define wdFieldDocVariable 64 PUBLIC oWordDocument *** set the LOCALEID to English nlLocaleId=sys(3004) && Save local id =sys(3006,1033) && Sending instructions in English oWordDocument=createobject("word.application") && Create word object with oWordDocument .Documents.Open("c:\temp\ander.doc") .ActiveDocument.variables("Cidade").value = "Porto Allegre" oRange=.ActiveDocument.Range(0,0) .ActiveDocument.Fields.Add(oRange, wdFieldDocVariable, "Teste1") .ActiveDocument.variables("Teste1").value = "Anderson Reis Girardi" .ActiveDocument.Fields.Update .visible = .t. endwith wait clear =sys(3006,val(nlLocaleId))I want to warn you for one thing. When using word VB commands use positional arguments not named arguments. ie:
.ActiveDocument.Fields.Add(oRange, Type=wdFieldDocVariable, Text="Teste1") && Wrong .ActiveDocument.Fields.Add(oRange, wdFieldDocVariable, "Teste1") && TrueCetin