Email from excel via Lotus Notes

gaz_chops

Well-known Member
Joined
Apr 29, 2003
Messages
6,485
Platform
  1. MacOS
I managed to find this piece of code on this site, which I thought (hoped) I might be able to adapt, one huge problem is that I have never used vb???
What I need to do is send an email to each of the house no.s (as per the excel example, but without the leading alpha character) and populate the ????in the vb with the "Model/Item"......any help would be hugely welcome

Thanks
Gaz

Sub SendNotesMail()
Dim Maildb As Object, UserName As String, MailDbName As String
Dim MailDoc As Object, Session As Object
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDatabase("", MailDbName)
If Maildb.IsOpen = True Then
Else: Maildb.OpenMail
End If
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = "0504" 'Nickname or full address
'MailDoc.CopyTo = 'whomever
'MailDoc.BlindCopyTo = Whomever
MailDoc.Subject = "Machine Change"
MailDoc.Body = _
Replace("As a result of a review of your AWP collections that I have carried out,@@I have asked Leisure Link to replace your ????? AWP.@@@@I or your Leisure Link Business Account Manager will try @@to phone you to discuss this within the next couple of days.@@However if you have any immediate comments,@@please do not hesitate to contact either of us." _
& Join(Application.Transpose(Range([b5], [b65536].End(3))), "@") _
& "@@With kind regards", "@", vbCrLf)
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo Audi
Call MailDoc.Send(False)
Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
Exit Sub
Audi:
Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
End Sub
PCIMIS Notes.xls
ABCD
1HseNo'Model/ItemRecommendation
2C050425NOTERUNNERchangetoJacktheKipper
3C322325ROYALROULETTEANBdropping-changetoSuperstars/TopDog/HiFlyer
4C122825HYPNOTICChangeHypnotic-urgent
5S556425TOPDOGChangetoBubble&Squeak/Jackpot&Beanstreak Changestilloutstanding
6S556425CASHEXPLOSIONnoedcsinceinstall-pleasecheck.Stillnoedcbeingreceivedpleasedealwith ChangetoMonopoly/Dambusters changestilloutstanding
7S556425DO$HNPECKSChangeQualityStreak/Superstars/Dambuster
8C325325CASHBANGWALLOPChangetoJumpinJokersorcashExplosionon82%
9S913525JACKPOTANDTHEBEANSTREAKChangeANBdropping-injectionplease
Sheet1
 
hi,

this looks really useful - i'm trying to send emails to addresses in column a but i can't seem to get the code to work.

I've changed this
MailDoc.SendTo = Right$(cl, Len(cl) - 1)
but it doesn't seem to be working
the email addresses are in usual format of abc@def.com

anyhelp would be greatly appreciated!

thanks
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I would think you would just want:

Code:
MailDoc.SendTo = cl.value
Then... Not sure why I wrote this that way, three years later... :-?
 
Upvote 0
thanks...have found this code so very very useful.
my only remaining problem is that I have access to 2 databases, I want to use a specific one that is shared but I find that the mails are sent from my personal db which must be the default.
I've tried changing
MailDbName = "sharedmail\***.nsf" but this hasn't worked.


thanks...
barry
 
Upvote 0

Forum statistics

Threads
1,224,617
Messages
6,179,914
Members
452,949
Latest member
beartooth91

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