Perguntas frequentes

Perguntas frequentes para auto-ajuda.

Por favor, dê uma olhada rápida nas perguntas comuns (e respostas) na lista padrão. Se você não encontrar o que está procurando, comece selecionando sua versão Ability Office e, em seguida, reduza-a inserindo o texto de pesquisa e/ou categoria.

Artigo da base de conhecimento 98

How to search and replace in Write

Suppose you had a template and wanted to search and replace a "field holder" with some text of your own. For example, in your document you type *namefld* where you want a user name to appear and *addfld* where the address should appear. The following subroutine implements a search and replace in the active document:

Sub FindAndReplace(find, replace)
Set mydoc = ActiveDocument
stxt = mydoc.Text.Mid(0, mydoc.Text.Count)

i = InStr(stxt, find) - 1
n = Len(find)
If (i > 0) Then
mydoc.Text.Delete i, n
mydoc.Text.Insert i, replace
End If
End Sub

And the following subroutine calls the above sub with some real data:

Sub TestReplace
FindAndReplace "*namefld*", "Phil Roach"
FindAndReplace "*addfld*", "Ability, London, England"
End Sub