Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
cuniberto
Contributor III
Contributor III

how to send mail by lotus notes

hi everyone,

i would like to send automatically an email by a Qlikwiew macro.

i'm using following instrunction tha doesent works:

Set nSess = CreateObject("Lotus.NotesSession")

any suggestion? i've already setted up the system acces on the security section.

here colpete script:

sub SendNotesMail_OCR_peggiori_1()

'Dim nSess As Object 'NotesSession

'Dim nDir As Object 'NotesDbDirectory

'Dim nDb As Object 'NotesDatabase

'Dim nDoc As Object 'NotesDocument

'Dim nAtt As Object 'NotesRichTextItem

'Dim vToList As Variant, vCCList As Variant, vBody As Variant

'Dim vbAtt As VbMsgBoxResult

'Dim sFilPath As String

'Dim sPwd As String

'************************************************************************** *****************

'LISTE INDIRIZZI

'************************************************************************** *****************

ReDim vToList(0)

vToList(0) = "f.cuniberto@arol.it"

'vToList(1) = ""

ReDim vCCList(0)

vCCList(0) = "f.cuniberto@arol.it"

'************************************************************************** *****************

'OGGETTO E CORPO

'************************************************************************** *****************

oggetto_mail = "Invio Report OCR Peggiori " & Date

corpo_mail = "Invio Automatico Lista OCR Peggiori"

'************************************************************************** *****************

'ALLEGATI

'************************************************************************** *****************

sFilPath1 = "J:\Scambio\Cuniberto\Monitor\OCR_peggiori.xls"

'sFilPath2 = ""

'sFilPath3 = ""

'************************************************************************** *****************

'To create notesession using COM objects, you can do so by using.

'either ProgID = Lotus.NotesSession

'or ClsID = {29131539-2EED-1069-BF5D-00DD011186B7}

'Replace ProgID by the commented string below.

'************************************************************************** *****************

Set nSess = CreateObject("Lotus.NotesSession") 'New:{29131539-2EED-1069-BF5D-00DD011186B7}

'************************************************************************** *****************

'This part initializes the session and creates a new mail document

'************************************************************************** *****************

'sPwd = Application.InputBox("Type your Lotus Notes password!", Type:=2)

sPwd = "kizivewo12"

Call nSess.Initialize(sPwd)

Set nDir = nSess.GetDbDirectory("")

Set nDb = nDir.OpenMailDatabase

Set nDoc = nDb.CreateDocument

'************************************************************************** *****************

'If you want to send it to multiple recipients then use variant array to get the names from

'the specified range as below

'Add / Remove Comment mark from vCCList as per your needs.

'************************************************************************** *****************

With nDoc

Set nAtt = .CreateRichTextItem("Body")

Call .ReplaceItemValue("Form", "Memo")

Call .ReplaceItemValue("Subject", oggetto_mail)

With nAtt

.AppendText (corpo_mail)

'Decide if you want to attach a file.

vbAtt = 6

Select Case vbAtt

Case 6

.AddNewLine

.AppendText ("********************************************************************")

.AddNewLine

Call .EmbedObject(1454, "", sFilPath1) '1454 = Constant for EMBED_ATTACHMENT

'Call .EmbedObject(1454, "", sFilPath2) '1454 = Constant for EMBED_ATTACHMENT

'Call .EmbedObject(1454, "", sFilPath3) '1454 = Constant for EMBED_ATTACHMENT

Case 7

'Do Nothing

End Select

End With

Call .ReplaceItemValue("CopyTo", vCCList)

Call .ReplaceItemValue("PostedDate", Now())

Call .Send(False, vToList)

End With

End sub

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

This is probably because your system doesn't have "Lotus.NotesSession"-type COM objects registered in Windows. As a result, it cannot create them.

You may need to install a Lotus Notes client or a Notes SDK on the machine where you want to run this macro.

cuniberto
Contributor III
Contributor III
Author

sorry, but when i run this script in VBA Access it works correctly.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

On the same platform?

QlikView uses VBScript, not VBApplications. VBScript is a reduced version of VisualBasic, just for scripting purposes. The fact that it runs in MS-Access does not mean it will run in QlikView. Also, this macro is embedded in a QVW document that may travel to another platform (like a server) where Lotus Notes is an unknown quantity. There are many things to take into account.

marcus_sommer

VBA Access is running successful on the same machine as QlikView?

Further there some slight differences between VBA and VBS and maybe some of your statements have not the right syntax. For example I'm not sure that your call-statements within the with-statement is really valid (I never use them in this way).

- Marcus