Email code bugging out

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

I hope someone can help on this

I have a workbook called "Test" with a worksheet called "Keyword"
In column "A" there is a date, column "B" a question

The code below so I'm told looks at the date and if it matched todays date will then email out the question is column "B"

Trouble is it bugs out on "TodayKeyword"

Any idea's please


[Sub MailOutKeyword()Dim DailyKeyword As String
DailyKeyword = TodayKeyword("C:\tmp\Test.xlsx")
Select Case DailyKeyword
Case "Error"
MsgBox "An error occurred while trying to distribute the daily Question Email.", vbInformation, "Error"
Case "None"
MsgBox "No Keyword was found for today.", vbInformation, "No Keyword Found"
Case "Sent"
Case Else
Dim objMail As Outlook.MailItem
Set objMail = CreateItem(olMailItem) 'send email

With objMail
.BodyFormat = olFormatPlain
.Subject = "Branch question " & Format(Date, "dd-mm-yyyy")
.HTMLBody = "<p>Todays question is:<br><br><b>" & DailyKeyword & "</b></p>"
.To = "Joe Bloggs"
.Display
End With
Set objMail = Nothing
End Select
End Sub]
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
TodayKeyword appears to be a UDF. Is this UDF in your module? If not, that's why the code is throwing an error. If its there, can you post it?
 
Upvote 0
TodayKeyword appears to be a UDF. Is this UDF in your module? If not, that's why the code is throwing an error. If its there, can you post it?
R

sorry Joe this is all I have, obviously there is code missing
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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