PDA

View Full Version : Send email via Lotus Notes by clicking a button



miguelc
06-20-2016, 04:06 AM
Hi there!!

I am working on a excel sheet (excel 2010) and I would like to know how to send emails from Excel through IBM Lotus Notes, using automation in VBA. I've been struggling with VBA for a long time now and still cannot find the solution to this problem.

Idea: In the excel spreadsheet you have many tabs "Paulo", "Alice" (just remaned "Sheet1", "Sheet2", etc) and in each one of them you will need to click on a button - "Ask for validation". Once you click on it, a new window pops up (the userform created using VBA) where you have the option to select the field names and from this input on the form send an email to multiple recipients.

It works for the 1st worksheet but something wrong happens when I try to apply the same code to another sheet (e.g. Julia) and the following error message appears: System Error &H8004110A (-2147217142). I am afraid this is not possible to execute due to a double object but I am not sure..
Then I run the debugger and on the 3rd line - Set nDir = nSess.GetDbDirectory("") - I got an error as follows:
Run-time error '-2147217504 (80040fa0)'
Automatic error

(Extraction from VBA code)



sPwd = Application.InputBox("Type your Lotus Notes password!", Type:=2)
Call nSess.Initialize(sPwd)
Set nDir = nSess.GetDbDirectory("")
Set nDb = nDir.OpenMailDatabase
Set nDoc = nDb.CreateDocument


I read sth online along the lines of UNK Table, I am not sure if it is related though.

Attach to this message follows the excel workbook so that you clearly understand what I mean.

Many thanks,
Miguel