FLOGINEEDHELP
New Member
- Joined
- Apr 16, 2011
- Messages
- 5
Hi,
I currently have the code below which sends the open excel sheet to an address which is hard coded into the VBA code. However i want the address to be one which comes from the excel sheet itself, so a cell reference, is this possible.
I have attached part of the code below which is affected
thanks in advance
I currently have the code below which sends the open excel sheet to an address which is hard coded into the VBA code. However i want the address to be one which comes from the excel sheet itself, so a cell reference, is this possible.
I have attached part of the code below which is affected
thanks in advance
HTML:
Sub Mail_workbook_Outlook_1()
Dim Cell As Range
Dim strbody As String
For Each Cell In ThisWorkbook.Sheets("FILE NAME").Range("FILE RANGE")
strbody = strbody & Cell.Value & vbNewLine
Next
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "EMAIL ADDRESS"
.CC = ""
.BCC = ""
.SUBJECT = "FILE NAME"
.Body = strbody
.Attachments.Add ActiveWorkbook.FullName
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing