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 :eek:

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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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,215,056
Messages
6,122,907
Members
449,096
Latest member
dbomb1414

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