Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Email Range as picture or bitmap. - Lotus Notes

I have spent SEVERAL days looking for a code that works and have not
been able to get it.

I need a macro that copies a certain cell range (named) as a bitmap or
picture, pastes it into the body of my email and sends it.

The names and subject is stationary, so I dont need it to ask each
time I send.

Can anyone point me in the direction of a proven code?

(Have tried over 15 - 20 already - all unsuccessful).

The following is the CLOSEST, but the range doesnt appear.
The range i want to copy is (B2:L22)

Please Help.


Sub LastTryAtLotusMail()

' setting up various objects
Dim Maildb As Object
Dim UserName As String
Dim MailDbName As String
Dim MailDoc As Object
Dim AttachME As Object
Dim Session As Object
Dim EmbedObj1 As Object
Dim recipient As String
Dim ccRecipient As String
Dim bccRecipient As String
Dim subject As String
Dim bodytext As String
Dim Attachment1 As String
Dim t1 As Range

Set t1 = Range("B2")


' setting up all sending recipients
recipient = "JEREMY ALDRIDGE"
ccRecipient = "JEREMY ALDRIDGE"
bccRecipient = "JEREMY ALDRIDGE"
subject = "Excel to Lotus Test Mail"
bodytext = "Testing this.."



'// Lets check to see if form is filled in Min req =Recipient,
Subject, Body Text
If recipient = vbNullString Or subject = vbNullString Or bodytext
= vbNullString Then
MsgBox "Recipient, Subject and or Body Text is NOT SET!",
vbCritical + vbInformation
Exit Sub
End If

' creating a notes session
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName)
- InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)

If Maildb.IsOpen < True Then
On Error Resume Next
Maildb.OPENMAIL
End If

Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"

' loading the lotus notes e-mail with the inputed data
With MailDoc
.SendTo = recipient
.copyto = ccRecipient
.blindcopyto = bccRecipient
.subject = subject
.Body = bodytext + t1
End With

' saving message
MailDoc.SaveMessageOnSend = True

Attachment1 = Worksheets("Sheet 1").Range("B2:L22").Value
If Attachment1 < "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment1")
Set EmbedObj1 = AttachME.EmbedObject(1454, "", Attachment1,
"Attachment")
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If


' send e-mail !!!!
MailDoc.PostedDate = Now()
' if error in attachment or name of recipients
On Error GoTo errorhandler1

MailDoc.Send 0, recipient

Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj1 = Nothing

'Unload Me
Exit Sub
' setting up the error message
errorhandler1:
MsgBox "Incorrect name supplied or the attachment has not
attached," & _
"or your Lotus Notes has not opened correctly. Recommend you open
up Lotus Notes" & _
"to ensure the application runs correctly and that a vaild
connection exists"

Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj1 = Nothing
' unloading the userform
'Unload Me
End Sub

Reply
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
lotus notes email pdaws Excel Worksheet Functions 2 October 2nd 08 04:08 PM
copy pasting bitmap into email in lotus notes [email protected] Excel Programming 0 May 31st 06 05:03 PM
Why won't AOL email communicate with lotus notes email? ManInaMaze Excel Discussion (Misc queries) 0 August 3rd 05 02:41 AM
Automating email using Lotus Notes Will Francis Excel Programming 0 August 25th 03 10:56 AM
Sending Email using Lotus Notes Bob[_26_] Excel Programming 1 July 29th 03 07:31 PM


All times are GMT +1. The time now is 05:45 PM.

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

About Us

"It's about Microsoft Excel"