VBA code .HTMLBODY issue

netreg

New Member
Joined
Aug 8, 2019
Messages
1
Hello folks

I am looking for some help with a problem that although small, is very frustrating :eeek:

I have some VBA code that essentially reads a spreadsheet and create an email. the code works fine at home (Windows 10 pro), but at work (also Windows 10 pro), I get an error of Run-time error ‘287’ Application-defined or object-defined error. Both home and work I am using Microsoft Office Professional Plus 2016 version of Outlook.


It doesn't like the .HTMLBody at the end of the line of code;
.HTMLBody = Email & GetDataHTML & Emailpt2 & .HTMLBody.

If I remove the end .HTMLBody, it reads in the data but doesn't add my signature, if I comment out the line totally, it creates the email(s) with my signature, but obviously no data is read in from excel.


Only difference between home and work I can determine is that at work Outlook connects to an exchange server. Can anyone advise if this would be the issue?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hello, please can you tell us:

1) Which data types the two variables Email and Emailpt2 are declared as; and
2) What the return data type of the function GetDataHTML is?

(Right-click the variables/function and select Definition from the context menu.)
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
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