Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the Sender Name

Status
Not open for further replies.

Gregdotcom

Technical User
Feb 27, 2006
3
0
0
GB
I've written a procedure in VBA for sending a number of e-mails via groupwise but I want the e-mails to look as if they are coming from someone else. Can anyone provide me with the syntax for this ? Do you need to have proxy for the person you want it to be sent by ? Here is the procedure :

Dim gwApplication As GroupwareTypeLibrary.Application2
Dim gwAccount As GroupwareTypeLibrary.Account2
Private Sub AccountLogon()

Dim objMessages As Object
Dim objMessage As Object
Dim objMailBox As Object
Dim objRecipients As Object
Dim objRecipient As Object
Dim objAttachment As Object
Dim objAttachments As Object
Dim objMessageSent As Variant
Dim Subject As String
Dim Attachment As String
Dim Recipient As String
Dim Bodytext As String
Dim objSystemAddressBook As Object
Dim objAddressBookEntries As Object
Dim objAddresses As Object

Sheets("Menu").Select
Application.ScreenUpdating = False
Application.StatusBar = "E_Mailing RFQs to Suppliers ..."
Sheets("DailyRFQs").Select


For Each VCODE In Range("VCODE")

RFQ = VCODE.Offset(0, 12).Value
VENDORCODE = VCODE.Value
SUPPLIER = VCODE.Offset(0, 1).Value
EXPEDITOR = VCODE.Offset(0, 5).Value
SENDINGTO = VCODE.Offset(0, 2).Value
EXPNAME = VCODE.Offset(0, 4).Value
PHONE = VCODE.Offset(0, 6).Value
EMAILADD = EXPEDITOR & "@whl.co.uk"
ATTACHMENTS1 = VCODE.Offset(0, 7).Value
ATTACHMENTS2 = VCODE.Offset(0, 8).Value
ATTACHMENTS3 = VCODE.Offset(0, 9).Value
ATTACHMENTS4 = VCODE.Offset(0, 11).Value

Set gwApplication = CreateObject("NovellGroupwareSession")
Set gwAccount = gwApplication.MultiLogin("maloneyg", , , egwPromptIfNeeded)

' ActiveCell.Value = gwAccount.Owner.DisplayName
' On Error GoTo Errorhandling

Set objSystemAddressBook = gwAccount.SystemAddressBook
Set objAddressBookEntries = objSystemAddressBook.AddressBookEntries

Set objMailBox = gwAccount.MailBox
Set objMessages = objMailBox.Messages
Set objMessage = objMessages.Add("GW.MESSAGE.MAIL", "Draft")
Set objRecipients = objMessage.Recipients
Recipient = SENDINGTO
Set objRecipient = objRecipients.Add(Recipient)


With objMessage
.Subject = "RFQ: " & RFQ & " - " & VENDORCODE & " " & SUPPLIER
.Bodytext = "Dear Sir/Madam," & vbCrLf & vbCrLf & "Please find RFQ attached. Please also find word documents instructing you how to complete the RFQ." & vbCrLf & vbCrLf & _
"Please could you sign and return the acceptance form also, if you haven't already done so." & vbCrLf & vbCrLf & _
"Thanks and regards," & vbCrLf & vbCrLf & _
EXPNAME & vbCrLf & vbCrLf & _
"Procurement Specialist" & vbCrLf & _
"Westland Helicopters Ltd." & vbCrLf & vbCrLf & _
"Tel: 01935 70" & PHONE & vbCrLf & _
"Fax: 01935 704508" & vbCrLf & _
"e-Mail: " & EMAILADD
.Attachments.Add ATTACHMENTS1
.Attachments.Add ATTACHMENTS2
.Attachments.Add ATTACHMENTS3
.Attachments.Add ATTACHMENTS4
End With
Set objMessageSent = objMessage.Send

ExitHere:

Set objMailBox = Nothing
Set objMessages = Nothing
Set objMessage = Nothing
Set objRecipients = Nothing
Set objAttachments = Nothing
Set objRecipient = Nothing
Set objAttachment = Nothing
'
Set gwApplication = Nothing
Set gwAccount = Nothing

Next

'Errorhandling:
'
' MsgBox Err.Description & " " & Err.Number

' Resume ExitHere

End Sub


I've seen some stuff about the SenderDisplayName proerty but don't know how to incorporate it into my procedure. Any suggestions ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top