Hi All,
As part of a bigger macro, I'm trying to get the macro to write and e-mail and I want the e-mail content to depend on a cell value in a worksheet.
I.e If cell is greater than 5, "no need to re-order", if cell is less than 5, "please place an order.
This is my test code below. I can get it to compile, probably a silly syntax error somewhere.
Any help gratefully received.
Sub IfTest()
Thanks,
Tiger
As part of a bigger macro, I'm trying to get the macro to write and e-mail and I want the e-mail content to depend on a cell value in a worksheet.
I.e If cell is greater than 5, "no need to re-order", if cell is less than 5, "please place an order.
This is my test code below. I can get it to compile, probably a silly syntax error somewhere.
Any help gratefully received.
Sub IfTest()
Code:
Windows("Test.xlsx").Activate
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
'
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
'
olMail.To = "test@test.com;"
olMail.Subject = "Test"
olMail.HTMLBody = "****** style=font-size:11pt;font-family:Calibri>" & _
"<p>If test below</p>" & _
"<p></p>" & _
If Range("A23") < 5 Then
("<p>Some e-mail text.</p>")
Else
("<p>Some other e-mail text.</p>")
End If
"</BODY>"
End Sub
Thanks,
Tiger