Macro for customised Email Subject Line Help

PCRIDE

Well-known Member
Joined
Jan 20, 2008
Messages
892
Hi, I have a Form, user presses a button to launch Outlook and populate an email. The subject currently has

=Replace(Replace("Issue |1: |2","|1",Nz([ID],"")),"|2",Nz([Title],""))

I need to add another field to this called Status. But simply adding the last bit of code bolded there, I get an error, maybe I am just missing something simple?


=Replace(Replace("Issue |1: |2","|1",Nz([ID],"")),"|2",Nz([Title],"")) ,Nz([Status],""))

Error

"The 'Email Database Object' macro action has an invalid value for the 'Subject' argument
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

AOB

Well-known Member
Joined
Dec 15, 2010
Messages
613
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
What kind of object are you 'setting' with this line? You appear to be adding your Status as some kind of argument (arg1, arg2) but not knowing the left hand side of the line makes it impossible to know? The equals sign, though, contradicts that, although the error message suggests a multi-argument object, so this is very confusing. Can you provide the full line rather than just the assignment? And also any declaration for whatever is on the left hand side?

Regardless, you have too many brackets in that second argument (one opening, two closing)

Is the Status supposed to be part of the subject, in the same way the ID and Title are?

If so, why not just :

Code:
=Replace(Replace(Replace("Issue |1: |2 |3", "|1", Nz([ID], "")), "|2", Nz([Title], "")), "|3", Nz([Status], ""))

As an aside - why complicate matters by including the |X placeholders and then replacing them? Why not just build the string?

Code:
="Issue " & Nz([ID], "") & ": " & Nz([Title], "") & " " & Nz([Status], "")

I'm sure I've misunderstood something here though so please post the full line of code and the objects in play...
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,772
Messages
5,833,606
Members
430,222
Latest member
jmmccormick

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
Top