User-defined type not defined in VBA

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
445
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all,

I am facing an issue with an email macro. Specifically, I used the one from this website:


However, when I run the code, it says the following:

1642666585217.png


Can somebody please help me fix this issue?

Thank you!

Kind regards,
Jyggalag
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
In the VB Editor, click Tools - References, locate the Microsoft Outlook reference and select it, then OK out of the dialog.
 
Upvote 0
Solution
In the VB Editor, click Tools - References, locate the Microsoft Outlook reference and select it, then OK out of the dialog.
You're a genius Rory!

Thank you so much! And apologies for what is probably a very silly question for you :) It works now!
 
Upvote 0
Glad we could help.

And they say the only silly question is the one you don't ask... :)
 
Upvote 0
Glad we could help.

And they say the only silly question is the one you don't ask... :)
I appreciate that!

Also, if I may ask one final question, in case you are good with VBA :)

I wrote & vbnewline to get some space inbetween my message when I email it,

However, when I send out the email it looks like this:

1642669872048.png


Do you maybe know why my vbnewline does not effectively separate my text in the email body?

Apologies for the additional question and thank you so much once again :)
 
Upvote 0
You used the HTMLBody property rather than Body. HTML ignores linefeeds (you need specific tags like br for that). It doesn't appear you are doing any formatting so I'd just use the Body property.
 
Upvote 0
You used the HTMLBody property rather than Body. HTML ignores linefeeds (you need specific tags like br for that). It doesn't appear you are doing any formatting so I'd just use the Body property.
Thank you!

It worked, but I am not able to write in bold with a line under like this now, so my former code looks like this now in the email:

1642671981763.png


Do you know of any alternative for <u><b> (underline and bold) when writing in Body rather than HTMLBody?

Thank you once again Rory! :)
 
Upvote 0
You used the HTMLBody property rather than Body. HTML ignores linefeeds (you need specific tags like br for that). It doesn't appear you are doing any formatting so I'd just use the Body property.
Figured it out!

Solution (and thanks once again for all your previous help Rory!): replace vbnewline with "<br>" :)
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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