I have this code working
txtFIND = "Order#" txtREPLACE = TextBox12 For Each d In Documents 'Loop all the open documents For Each p In d.Pages 'Loop each page p.TextReplace txtFIND, txtREPLACE, True, False Next p Next d
But I need it to just search the active page and not the entire document with multiple pages and any other document that is open in corel.
What am I doing wrong here?
Very quick solution:
txtFIND = "Order#"txtREPLACE = TextBox12ActivePage.TextReplace txtFIND, txtREPLACE, True, False
Perfect!! Thank you.
I have 30+ items that I am searching on the page. Do I need to put that code after each find & replace or is there something better?
Basically yes!But this depends how you arrange your page and your data source.A simple way would beFor i=1 to 30 txtFind="Term#"+trim(str(i)) TxtReplace=Inputbox("Enter replacement for "+txtFind) ActivePage.TextReplace txtFIND, txtREPLACE, True, False Next iBut here you have to name the txtFind's in you page matching the new expressions.In a much higher advanced level it is even possible to create an Excel sheet with column captions representing the terms you want to replace and fill below the new values. Then you can set a filter to make only some rows visible and create for each visible row an output with the specific values.Maybe you can provide more information about your document and your needs to figure out an useful solution.
I uploaded the file so you can look at it and see what we are doing. Basically we have a form setup in Corel that we run this find & replace script to make the changes.ProForm.zip