Log in

View Full Version : .From Email



owntor
12-14-2006, 10:07 PM
How does one enter the from address using VBA? Is it possible?

I tried '.From', but this does not work.

Sub email()
Dim olApp As Object
Set olApp = CreateObject("outlook.application")
With olApp.CreateItem(0)
.To = to_email
' .from = from_email
.subject = "subject test"
.body = body
.Save
End With
Set olApp = Nothing

End Sub

Marcster
12-15-2006, 11:00 AM
.SenderName
But it's read-only.

Marcster.

owntor
12-15-2006, 02:17 PM
Marcster, thanks for you reply.

Since it's read only, it's not possible to write to that field then? Is there a way to trick outlook to do it?

Marcster
12-16-2006, 01:23 AM
As it's a read-only field you can't write to that field.

There are ways to trick Outlook though.
But you can still trace who sent it.

Can I ask why you want to do this?.
As there maybe an easier way of doing what your trying to achieve?.

Marcster.

owntor
12-16-2006, 02:06 AM
.SentOnBehalfOfName seems to work. It writes to the 'From' field at any rate.

This is for a mass company e-mailing that needs to come from a specific mailbox.

owntor