Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext

PLEASE IGNORE (POSTED TWICE IN ERROR)
Darren J Halka 18.Aug.03 06:34 PM a Web browser
Notes Client -- Other 4.6.5 Windows NT

Note:
- Using Excel 97
- VBA Project includes Reference of 'Lotus Notes Automation Classes' (notes32.tlb)

Using Excel VBA, I am trying to send an e-mail (via Lotus Notes) that includes text and an attachment.

While I have got this to essentially work, I am having problems resolving the following:
1) How to get the text portion of the e-mail to be formatted Red and Bold. While you will see that my procedure below has the code setting the Style and Item, this does not work.
2) How can I have a copy of the sent email placed in a 'Sent Mail' folder -
not I have tried the PUTINFOLDER and SAVEMESSAGEONSEND methods but neither
have been successful.
3) The procedure fails if Lotus Notes is not open. Any ideas of how to get around this, ie check to see if Notes is open, and if not then open the application.

Any help would be greately appreciated.


Below is the procedure I am using:

Sub MailCreditCardWorkbooks()

Dim objNotesSession As Object
Dim objNotesDB As Object
Dim objNotesDoc As Object
Dim objNotesRTI As Object
Dim objNotesRTS As Object

Dim strCCPeriod As String
Dim strPath As String
Dim strCCYear As String
Dim strCCMonth As String
Dim strFileName As String
Dim strMailAddress As String
Dim rngMyCC As Range

strCCPeriod = UCase(Format(Range("rnPeriodFrom"), "MMM YY"))
strPath = "S:\Life\Wellington\Accounts Payable\Credit Cards\Send to Card Holder\"
strCCYear = Format(Range("rnPeriodFrom"), "YYYY")
strCCMonth = Format(Range("rnPeriodFrom"), "MM")

'Final Path location
strPath = strPath & strCCYear & "\" & strCCMonth & "\"

Set objNotesSession = CreateObject("Notes.NotesSession")
Set objNotesDB = objNotesSession.GETDATABASE("", "")
Call objNotesDB.OPENMAIL

For Each rngMyCC In Range("rnCreditCards")
'Only e-mail Workbooks for Credit Cards with a balance
If Not (rngMyCC.Offset(0, 1).Value = 0) Then
strFileName = rngMyCC.Offset(0, -2)
strMailAddress = CStr(rngMyCC.Offset(0, 2))
Application.StatusBar = "Sending Credit Card File to: " & strFileName & " (" & strMailAddress & ")"
'Create new mail message
Set objNotesDoc = objNotesDB.CREATEDOCUMENT
objNotesDoc.SendTo = strMailAddress
objNotesDoc.Subject = strFileName & " - Credit Card Analysis: " & strCCPeriod
objNotesDoc.ReturnReceipt = "1"

Set objNotesRTS = objNotesSession.CREATERICHTEXTSTYLE
Set objNotesRTI = objNotesDoc.CREATERICHTEXTITEM(objNotesDoc, "body")

objNotesRTS.NOTESCOLOR = 2
objNotesRTS.FontSize = 12
objNotesRTS.Bold = True

Call objNotesRTI.APPENDSTYLE(objNotesRTS)
Call objNotesRTI.APPENDTEXT(strFileName & " - Credit Card Analysis: " & strCCPeriod)
Call objNotesRTI.ADDNEWLINE(2)
Call objNotesRTI.APPENDTEXT("Please complete the attached workbook for the analysis of " _
& "your Credit Card transactions for the month of: " _
& strCCPeriod)
Call objNotesRTI.ADDNEWLINE(2)
Call objNotesRTI.EMBEDOBJECT(1454, "", strPath & strFileName & ".XLS")

'Send message
Call objNotesDoc.SEND(False)

'Clear objects
Set objNotesDoc = Nothing
Set objNotesRTI = Nothing
Set objNotesRTS = Nothing
End If
Next rngMyCC

Application.StatusBar = False

'Clear objects
Set objNotesDB = Nothing
Set objNotesSession = Nothing

End Sub






  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow