Pulling an email address from a cell using Offset

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
169
Greetings everyone,

I'm hoping someone can help me here. I'm trying to send an email from excel but I want to pull the email out of a cell that is 6 columns to the right of the active cell.

I can make it run ok when I'm using range (.to = Sheets("Quote Register").Range("J11")) but having issues with offset. (Coloured blue)

Sub Sent_Test_Email()
On Error GoTo ErrHandler

' SET Outlook APPLICATION OBJECT.

Dim objOutlook As Object
Set objOutlook = CreateObject("Outlook.Application")

' CREATE EMAIL OBJECT.
Dim objEmail As Object
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
'.to = "slave@resolve.net.au"
'.to = Sheets("Quote Register").Range("J11")

.to = Sheets("Quote Register").ActiveCell.Offset(7, 0)
.Subject = Sheets("Quote Register").Range("K11")
.Body = Sheets("Quote Register").Range("L11")
.Display ' Display the message in Outlook.
End With

' CLEAR.
Set objEmail = Nothing: Set objOutlook = Nothing

ErrHandler:
'
End Sub

Thanks for any help.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
ActiveCell is not a Sheet property, so your syntax is not correct.

Try:

VBA Code:
.to = ActiveCell.Offset(, 6).Value
 
Upvote 0
Solution

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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