Search Results

Search found 1 results on 1 pages for 'user2530616'.

Page 1/1 | 1 

  • Outlook VBA script - find and replace text with image

    - by user2530616
    I have a e-commerce store. When I get a sale, I receive an order confirmation email which contains the name of the product sold. When the email comes through, I would like to run a script that replaces the product name eg. "red widget", with a picture of that product. Is that possible? I have found a similar code to replace text (set of numbers in this case) with a link, but I need it to replace with a picture instead. Option Explicit Sub InsertHyperLink(MyMail As MailItem) Dim body As String, re As Object, match As Variant body = MyMail.body Set re = CreateObject("vbscript.regexp") re.Pattern = "#[0-9][0-9][0-9][0-9][0-9][0-9]" For Each match In re.Execute(body) body = Replace(body, match.Value, "http://example.com/bug.html?id=" & Right(match.Value, 6), 1, -1, vbTextCompare) Next MyMail.body = body MyMail.Save End Sub example mail Order Confirmation Thanks for shopping with us today! ------------------------------------------------------ Order Number: 2209 Date Ordered: Friday 28 June, 2013 Products ------------------------------------------------------ 1 x red widget = $5.00 ------------------------------------------------------ Total: $0.00 Delivery Address xxx search text: "red widget" replace picture: redwidget.jpg

    Read the article

1