Change Outlook Subject with VBA

CMJ

New Member
Joined
Jul 26, 2012
Messages
11
Hi,

I'm trying to create a template so that I can have VBA prompt me to change items in the subject. I've got a template email with the subject line that should be Project / GC/Client, and in the template I've written that as #0# / #1 #. So far, I'm at the below, but it's erroring. Anyone have any ideas on how to correct?

Thanks!
Code:
Private Sub m_Inspector_Activate()
  dim Item as MailItem
  dim Value as string
  if typeof m_Inspector.currentitem is mailitem then
    set mail=m_Inspector.currentitem
    if mail.subject="subject" then
      value=inputbox("Project")
      mail.subject=replace(mail.subject,"#0#",value)


      value=inputbox("GC/Client")
      mail.subject=replace(mail.subject,"#1#",value)
    endif
  endif
end sub
 
Last edited by a moderator:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top