Outlook.Application. Trying to specify 'To' recipient by using the 'From' field.

Sorry for the confusing title.

I am automating emails. I build a string of email addresses that I am sending templates to (not spam =P ). I am sending them via BCC. So I want to make myself the person I am sending the email to.  Is there an attribute in Outlook.Application that uses that?

code snipit below.

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'query database to get rs3 result set
'correctly builds my recipient string
Do Until rs3.EOF
 strTo = rs3.Fields(7).Value & "; " & strTo
With objEmail
    '.To = i want this to be the person who is composing the email
    .subject = subject
    .Body = letterBody
    '.ReadReceiptRequested = True
    .BCC = strTo
End With

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kelvin SparksCommented:
You can either hard code your email address in the .To line or make it equal to a input box where the user enters their email address
Neil2526Author Commented:
Thank you for your comment kelvin.

I'd like to stray from hard coding the email address in the code because different people may be sending out emails. I also don't have any input as to who enters their email address.  I was hoping there would be another way.

How do you want the system to know who the sender is? I have used some code that gets the user login name. That could possibly be used to  lookup the email address of the sender but I would need to know more.
About the best you'll get is using the Resolve action to attempt to make use of a user's login as gemost has mentioned. Here's a full reference if you want to look into the resolve option


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.