https://issues.apache.org/ooo/show_bug.cgi?id=123816
Bug ID: 123816
Issue Type: DEFECT
Summary: Cannot send email with attachment via VBA code taking
Notes as mail application
Product: App Dev
Version: 4.1.0-dev
Hardware: All
OS: All
Status: CONFIRMED
Severity: critical
Priority: P2
Component: vba
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected],
[email protected], [email protected]
Steps:
1. Copy the following VBA code in AOO Calc(please note to change the notes mail
db "C:\notes\Data\guoyanp.nsf", send to notes id "[email protected]" and
config file "d:\config.txt" correspondingly to your test data), please refer
the sample in Attachment
2. Run the VBA code
Expected result: email with attachment is sent out
Actual result: cannot send the email with attachment with error message.
Notes: email with no attachment can be sent out
REM ***** BASIC *****
Sub Main
Dim db As Object
Dim MailDoc As Object
Dim AttachME As Object 'The attachment richtextfile object
Dim EmbedObj As Object 'The embedded object (Attachment)
Set Session = CreateObject("Lotus.NotesSession")
Call Session.Initialize
Set db = Session.GETDATABASE("", "C:\notes\Data\guoyanp.nsf")
'Open DB
If db.IsOpen = False Then db.OPENMAIL
Set MailDoc = db.CREATEDOCUMENT
With MailDoc
Call .ReplaceItemValue("Form", "Memo")
Call .ReplaceItemValue("SendTo", "[email protected]")
Call .ReplaceItemValue("CopyTo", "")
Call .ReplaceItemValue("Subject", "Hello")
Set Body = .CREATERICHTEXTITEM("Body")
Call Body.APPENDTEXT("How are you")
.SaveMessageOnSend = True
Set AttachME = .CREATERICHTEXTITEM("Attachment")
'************** This statement fails here ********************
'Commented since its not working but works in MS Excel VBA
'Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", sAttachment, "Attachment") '1454
= Constant for EMBED_ATTACHMENT
'OpenOffice Starbasic equivalent code for above statement
Call AttachME.EmbedObject(1454, "", "d:\config.txt") '1454 = Constant for
EMBED_ATTACHMENT
'************** End of statement fails ********************
.ReplaceItemValue("PostedDate","2013/1/1")
.send (False)
End With
Set MailDoc = Nothing
End Sub
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.