Make an inputQuery replace a variable in the word if the condition is true

Asked

Viewed 54 times

0

I am working with Delhi and I need a method that does the following in the open word document look for a@Name variable if it finds the@Name variable open an inputQuery for the user to enter the new variable value and then replace@Name with the entered value in Inputquery.

Obs: the replacement part I already know my problem is even in the part of the algorithm go through the document and if it finds the variable return the inputQuery if it does not find just continue running the rest of the code.

Begin
if Doc.Content.Find.Execute(FindText := '@Ref') then
  InputQuery('Nome Funcionario', 'Insira um Valor:', ref);
  Doc.Content.Find.Execute(FindText := '@Ref', ReplaceWith := ref);
end;
  • I would put the text content in a Memo, loop it through each character, and when I found@, store the following characters up to the next 'space' and replace them. After the entire process completed, it would save the contents of Memo to a . doc file.

  • If you put the existing logic (code) it would be easier for the people here to help you.

  • Thank you very much, but I’ve figured out how it works and it worked I will edit the publication with the code for better understanding

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.