LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel to Open Lotus Notes

Hi,

I need some VB code that will enable me to send an attachment from
excel to Lotus Notes, but I would like to enable the user to add email
addresses once the file has been forwarded to Lotus Notes.

This is the code i have at the moment - it create the par spreadsheet,
then attaches it to an email, but it sends it just to one address which
I have inputted in the code, this send the attachment invisably. Which
means you cannot add other addressee's in the email without the code.
CAN SOMEONE PLEASE HELP!

Sub Email_IMP_EXP()

Dim noSession As Object, noDatabase As Object
Dim noDocument As Object, noAttachment As Object
Dim vaFiles As Variant
Dim OneFile As Boolean
Dim I As Long
Dim strFile As String
Dim wb As Workbook
Dim strdate As String

Const EMBED_ATTACHMENT = 1454
Dim stSubject As String
Dim stMsg As String
Dim vaRecipient As Variant

'Populate the variant-array with recipients.
vaRecipient = InputBox("Email recipient", "?????", ")
stSubject = "Import & Export Bonus Figures"
stMsg = "Please find attached the Import and Export Bonus
Information"
'Get the Excel-files from the user(s).
strdate = Format(Now, "dd-mm-yy")
Sheets(Array("IMPORT Daily", "EXPORT Daily")).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs ThisWorkbook.Name & " " & strdate & ".xls"
End With

strFile = ActiveWorkbook.FullName
OneFile = True

finish:
'Instantiate the Lotus Notes COM objects.
Set noSession = CreateObject("Notes.NotesSession")
Set noDatabase = noSession.GETDATABASE("", "")

'Check if mail-database is open or not.
If noDatabase.IsOpen = False Then noDatabase.OPENMAIL

'Instantiate the Lotus E-mailobject.
Set noDocument = noDatabase.CREATEDOCUMENT
Set noAttachment = noDocument.CREATERICHTEXTITEM("Body")

'Add the selected Excel-files to the E-mail.
With noAttachment
.EMBEDOBJECT EMBED_ATTACHMENT, "", strFile
End With
With wb
.Close False
End With
'Populate mainproperties of the created E-mail and save & send
'the e-mail.

With noDocument
.Form = "Memo"
' .SendTo = vaRecipient
.Subject = stSubject
.Body = stMsg
.SaveMessageOnSend = True
.PostedDate = Now()
.SEND 0, vaRecipient
End With
'Release objects from memory.
Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing

'Return to Excel.
AppActivate "Microsoft Excel"

MsgBox "The e-mail has successfully been created and sent!",
vbInformation, "PARCELFORCE"
Exit Sub

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Lotus Notes with Excel Macro Steve Excel Discussion (Misc queries) 3 April 2nd 09 04:45 PM
open lotus notes pdaws Excel Worksheet Functions 0 January 12th 09 04:00 PM
Open Lotus Notes attachments aww91 Excel Programming 0 October 4th 06 02:30 AM
Using Currently Open Lotus Notes Mail Server Info in Excel Macro Scottms Excel Programming 0 June 27th 06 07:55 PM
Test if Lotus Notes open MAx Excel Programming 2 May 7th 04 04:11 AM


All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"