Write excel cell value into new email
example - I would like the value of cell A1 from an excel worksheet to write into my the body of my email.
How would I go about this?
This is the code I have so far. (Found on another thread and slightly modified.)
Code:
Sub SendMailMessage()
Dim objOLapp As Object, obXLapp As Object
Dim objMailItem As Object
Dim strBody As String
Dim un As String
Set obXLapp = CreateObject("Excel.Application")
Set objOLapp = CreateObject("Outlook.Application")
Set objMailItem = objOLapp.CreateItem(0) '0=mailitem
un = Environ("USERNAME")
With obXLapp
.Visible = True
.Workbooks.Open ("D:\Documents and Settings\" & un & "\My Documents\MyExcelFile.xls")
End With
' strBody = range("A1").value ???
With objMailItem
.Body = strBody
End With
End Sub