26 Jul 12 11:40
I am wondering if somebody can help me with a VBA code that would pass a file into the clipboard. So if a file exists (e.g. C:\Temp\1.xls) I would like to pass it into the clipboard so that I could paste it into a Lotus Notes email.
The following code allows me to create a Lotus Notes memo
[code] Dim CN, UserName, MailFile As String
Dim workspace As Object
Set workspace = CreateObject("Notes.NotesUIWorkspace")
Dim session As Object
Set session = CreateObject("Notes.NotesSession")
CN = session.COMMONUSERNAME
UserName = LCase(Left(Left$(CN, 1) & Right$(CN, (Len(CN) - InStr(1, CN, " "))), 8)) & ".nsf"
Set session = Nothing
MailFile = "mail\" & UserName
Dim NotesUIDoc As Object
Set NotesUIDoc = workspace.COMPOSEDOCUMENT("", "", "Memo")
Call NotesUIDoc.FIELDSETTEXT("EnterSendTo", "Me@Me.com")
Call NotesUIDoc.FIELDSETTEXT("EnterCopyTo", "Me2@Me.com")
Call NotesUIDoc.FIELDSETTEXT("Subject", "Test Email")
And what I'm trying to do is paste the file at C:\Temp\1.xls into the email. I have found that if I pause the code, go into Windows explorer, select 1.xls and press Ctrl+C, then run
[code] Call NotesUIDoc.Paste [/code]
The file gets saved into the email.
However, I am unable to find the code that will pass the file into the clipboard so that the Paste function works.
I recognize there are other ways to send Lotusnotes emails with attachment (such as with createrichtext) but the methods I've seen do not allow you to edit the email. Could anybody provide help on this?
Thanks very much