Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find and replace text in HTM

Status
Not open for further replies.

PhilBreau

Technical User
Dec 14, 2001
108
CA
I have a signature file I use in outlook as a template. I want to search for several words and replace them with cells of specific columns from on the current row of the cursor. I use generic words in the template as variables. I want to search and replace these variables and create a new signature file. for simplicity, the variables are in CAPS and highlighted in red

Here is the signature file:

{\rtf1\ansi\ansicpg1252\deff0\deflang4105\deflangfe4105{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\froman\fprq2\fcharset0 Times New Roman;}}
{\colortbl ;\red31\green73\blue125;\red0\green0\blue255;}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\cf1\f0\fs22 Hi all,\par
\par
The part is being shipped to FIRSTNAME LASTNAME as requested. UPS tracking number \cf2\ul{\field{\*\fldinst{HYPERLINK "TRACKINGNUMBER}{\fldrslt{TRACKINGNUMBER}}}\f0\fs22. \cf1\ulnone They should arrive by TIME tomorrow. FIRSTNAME please advise once you receive them.\par
\par
\par
Thank you,\par
\par
MYNAME\par
\cf0\f1\par
}



There is formatting in the HTM file, but I want to keep the file exactly as it is, but find and replace the variables.


Thank you
 
Looks like your signature file is just a simple text file and you want to use an Excel file with the new data (right?). Read your 'template' text file (line-by-line), do Replace("Whatever", "With New whatever"), and save it as new signature file. Easy to do in VBA (another Forum on TT)

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top