Serial Route Memo via Code

weilerdo

Registered User.
Local time
Today, 03:07
Joined
Apr 21, 2005
Messages
109
Hi All, I hope someone will know if this is possible. I am sending a report from Access via Lotus Notes ( which is working fine ) but my boss would like the report to be a Serial Route Memo. I know there are like 75 threads about Lotus Notes out there but I cant seem to find anything on using a different type of Memo. Here is the code that I am using.

Sub CreateMailandAttachFileAdr(Optional ByVal SendToAdr As String = "", Optional CCToAdr As String = "", Optional _
BCCToAdr As String = "", Optional Attach1 As String = "", Optional Attach2 As String = "")

Const EMBED_ATTACHMENT As Integer = 1454
Const EMBED_OBJECT As Integer = 1453
Const EMBED_OBJECTLINK As Integer = 1452

Dim s As Object ' use back end classes to obtain mail database name
Dim db As Object '
Dim doc As Object ' front end document
Dim beDoc As Object ' back end document
Dim workspace As Object ' use front end classes to display to user
Dim bodypart As Object '
Dim Maildb As Object 'The mail database
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim AttachME As Object 'The attachment richtextfile object
Dim Attachment As String

Call CreateNotesSession

Set s = CreateObject("Notes.Notessession") 'create notes session
Set db = s.getDatabase("", "") 'set db to database not yet named
Call db.Openmail ' set database to default mail database
Set beDoc = db.CreateDocument

Set bodypart = beDoc.CreateRichTextItem("Body")

' Filling the fields
'###################

beDoc.SendTo = SendToAdr
beDoc.CopyTo = CCToAdr
beDoc.BlindCopyTo = BCCToAdr
beDoc.Body = "Hello Please see the attached PO Request"
beDoc.Subject = "Purchase Order Request"
'''''''''''''''''''''''''
''If you want to send a message to more than one person or copy or
''blind carbon copy the following may be of use to you.

'beDoc.sendto = Recipient
'beDoc.CopyTo = ccRecipient
'beDoc.BlindCopyTo = bccRecipient
'beDoc.BlindCopyTo = BCCToAdr
''Also for multiple email addresses you just set beDoc.sendto (or CopyTo or
''BlindCopyTo) to an array of variants each of which will receive the message. So

'Dim recip(25) as variant
'recip(0) = "emailaddress1"
'recip(1) = "emailaddress2" e.t.c

'beDoc.sendto = recip
''''''''''''''''''''''''

' beDoc.Body = "Hello Mary Lou, Goodbye heart"

' Attaches i
'###########
' Call bodypart.EmbedObject(EMBED_ATTACHMENT, "", DirWithPathFileName, FileName)
If Len("po.xls") > 0 Then
If Len("D:\po.xls") > 0 Then
Call bodypart.EmbedObject(EMBED_ATTACHMENT, "", "D:\po.xls", "po.xls")
End If
End If

' Attaches II
'############
If Len(Attach2) > 0 Then
If Len(Dir(Attach2)) > 0 Then
Call bodypart.EmbedObject(EMBED_ATTACHMENT, "", Attach2, Dir(Attach2))
End If
End If

Set workspace = CreateObject("Notes.NotesUIWorkspace")

' Positioning Cursor
'###################
' Call workspace.EditDocument(True, beDoc).GotoField("Body")
Call workspace.EditDocument(True, beDoc).GotoField("Subject")

Set s = Nothing
Kill "D:\po.xls"
End Sub
 

Users who are viewing this thread

Back
Top Bottom