pjeanphilippe
Member
- Outlook version
- Outlook 2010 32 bit
- Email Account
- Exchange Server
Hi:
I am fairely new to coding, so pardon the ignorance. I am trying to use Visual Basic to create a couple of macros for me in Outlook 2010. It works fine until I try to insert a code for Subject, then everything goes awry. I haven't even tried to insert text into the coding because I have been spending most of my time debugging the issue. I've looked into so many different websites and no information has worked thus far. Please help.
Thank you so much.
Sub Try()
Dim olApp As Outlook.Application
Dim olMailItem As Outlook.MailItem
Dim olInsp As Outlook.Inspector
Dim strHTMLBody As String
Dim olMsg As Outlook.MailItem
Set olApp = New Outlook.Application
Set olInsp = olApp.ActiveInspector
Set olMsg = Application.CreateItem(olMailItem)
olMsg.Subject = "My Subject"
olMsg.Display
strHTMLBody = olMailItem.HTMLBody
olMailItem.BodyFormat = olFormatHTML
olMailItem.HTMLBody = "<HTML><BODY><FONT face=""Calibri"" size=3 color=black> Hi [name of person]:" & _
"<BR><BR> Can you blah blah blah <b>[Name of Course]</b> in <b>[enter Month]</b>?" & _
"<BR><BR><BR> When done, can you blah blah blah?" & _
"<BR><BR> Thank you so much. </FONT></BODY></HTML>" & vbCrLf & vbCrLf & strHTMLBody
End Sub
I am fairely new to coding, so pardon the ignorance. I am trying to use Visual Basic to create a couple of macros for me in Outlook 2010. It works fine until I try to insert a code for Subject, then everything goes awry. I haven't even tried to insert text into the coding because I have been spending most of my time debugging the issue. I've looked into so many different websites and no information has worked thus far. Please help.
Thank you so much.
Sub Try()
Dim olApp As Outlook.Application
Dim olMailItem As Outlook.MailItem
Dim olInsp As Outlook.Inspector
Dim strHTMLBody As String
Dim olMsg As Outlook.MailItem
Set olApp = New Outlook.Application
Set olInsp = olApp.ActiveInspector
Set olMsg = Application.CreateItem(olMailItem)
olMsg.Subject = "My Subject"
olMsg.Display
strHTMLBody = olMailItem.HTMLBody
olMailItem.BodyFormat = olFormatHTML
olMailItem.HTMLBody = "<HTML><BODY><FONT face=""Calibri"" size=3 color=black> Hi [name of person]:" & _
"<BR><BR> Can you blah blah blah <b>[Name of Course]</b> in <b>[enter Month]</b>?" & _
"<BR><BR><BR> When done, can you blah blah blah?" & _
"<BR><BR> Thank you so much. </FONT></BODY></HTML>" & vbCrLf & vbCrLf & strHTMLBody
End Sub