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
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

AOB

Well-known Member
Joined
Dec 15, 2010
Messages
598
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...
 

Watch MrExcel Video

Forum statistics

Threads
1,122,689
Messages
5,597,550
Members
414,155
Latest member
Grainne whiteside

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