Inserting Images into Lotus Notes Email

santeria

Well-known Member
Joined
Oct 7, 2003
Messages
1,844
Finally I have the code all okay for Sending Reports, and other extra comments etc...

And now...
Is there code available for picking up images ( Screen snaps) and inserting into an email in Notes after the Body of the Message?

Either a reference to a link or some code would be greatly appreciated, cos I cannot find any info at this point in the archives ( Presuming I have searched using proper parameters ).

Ta

:bow:
 
The Pics I have are two files ( Screen Snaps ) as jpgs, in the same directory as my data directory for the day.

I can do the emails fine.
The fly in the ointment at the moment is how do I get the Images in after the Text Body, and the file has been inserted.

( And if Possible, can a txt file be inserted to read as a message relavent to that day file... something which contains comments on the days data ).

Anyway, the images are the main thing.


Ta

:bow:
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hello again,

The following works for me:

<font face=Courier New><SPAN style="color:darkblue">Sub</SPAN> test()
<SPAN style="color:darkblue">Dim</SPAN> MyPic <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>
Application.ScreenUpdating = <SPAN style="color:darkblue">False</SPAN>
<SPAN style="color:darkblue">Set</SPAN> MyPic = ActiveSheet.Pictures.Insert( _
    "C:\Temp\My Picture.jpg")
<SPAN style="color:darkblue">Call</SPAN> SendMail(MyPic)
MyPic.Delete
<SPAN style="color:darkblue">Set</SPAN> MyPic = <SPAN style="color:darkblue">Nothing</SPAN>
Application.ScreenUpdating = <SPAN style="color:darkblue">True</SPAN>
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN>

<SPAN style="color:darkblue">Private</SPAN> <SPAN style="color:darkblue">Sub</SPAN> SendMail(<SPAN style="color:darkblue">ByRef</SPAN> MyPic <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>)

<SPAN style="color:darkblue">Dim</SPAN> Notes <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, db <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, WorkSpace <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>
<SPAN style="color:darkblue">Dim</SPAN> UIdoc <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, UserName <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">String</SPAN>, MailDbName <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">String</SPAN>

<SPAN style="color:darkblue">Set</SPAN> Notes = CreateObject("Notes.NotesSession")

UserName = Notes.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
    (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

<SPAN style="color:darkblue">Set</SPAN> db = Notes.GetDataBase(vbNullString, MailDbName)

<SPAN style="color:darkblue">Set</SPAN> WorkSpace = CreateObject("Notes.NotesUIWorkspace")
<SPAN style="color:darkblue">Call</SPAN> WorkSpace.ComposeDocument(, , "Memo")

<SPAN style="color:darkblue">Set</SPAN> UIdoc = WorkSpace.CurrentDocument
<SPAN style="color:darkblue">Call</SPAN> UIdoc.FieldSetText("SendTo", "Jane C Doe") <SPAN style="color:green">'Recipient</SPAN>
<SPAN style="color:darkblue">Call</SPAN> UIdoc.FieldSetText("Subject", "Pic Time")

MyPic.Copy
<SPAN style="color:darkblue">Call</SPAN> UIdoc.GotoField("Body")
<SPAN style="color:darkblue">Call</SPAN> UIdoc.InsertText(WorksheetFunction.Substitute( _
    "Hello!@@Check out the pic eh:@@", _
    "@", vbCrLf))
<SPAN style="color:darkblue">Call</SPAN> UIdoc.Paste
<SPAN style="color:darkblue">Call</SPAN> UIdoc.InsertText(Application.Substitute( _
    "@@Later,@Me", "@", vbCrLf))
Application.CutCopyMode = <SPAN style="color:darkblue">False</SPAN>

<SPAN style="color:darkblue">Call</SPAN> UIdoc.Send(False)
UIdoc.<SPAN style="color:darkblue">Close</SPAN>

<SPAN style="color:darkblue">Set</SPAN> UIdoc = Nothing: <SPAN style="color:darkblue">Set</SPAN> WorkSpace = <SPAN style="color:darkblue">Nothing</SPAN>
<SPAN style="color:darkblue">Set</SPAN> db = Nothing: <SPAN style="color:darkblue">Set</SPAN> Notes = <SPAN style="color:darkblue">Nothing</SPAN>

<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>

Call it from test().
 
Upvote 0
Thanks.

Looks very Appropos.

I'll test that, and let you know :-)


Should this Macro be Substituted for an existing Email Macro?

Also, in a Notes Address, if I have a Group Address, is it best to put in the Group Address, or have the Full list of people ?



Ta Muchly.

:bow:
 
Upvote 0
Also, to place in two or More Images ( Imported, not merely Attachments), do I just repeat the image line, or is there an array, etc... needed ?

The txt file was basically an element that needs to be inserted in days that require me to comment on aspects of the Report.
It seems like if I insert the txt file, then it saves me time when sending out the email, and also gives me a separate record of comments in my archives.




Ta

:bow:
 
Upvote 0
Yep, use the group address.

Try the following:

<font face=Courier New><SPAN style="color:darkblue">Sub</SPAN> test()
<SPAN style="color:darkblue">Dim</SPAN> MyPic1 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, MyPic2 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>
Application.ScreenUpdating = <SPAN style="color:darkblue">False</SPAN>
<SPAN style="color:darkblue">Set</SPAN> MyPic1 = ActiveSheet.Pictures.Insert( _
    "C:\Temp\Picture 1.jpg")
<SPAN style="color:darkblue">Set</SPAN> MyPic2 = ActiveSheet.Pictures.Insert( _
    "C:\Temp\Picture 2.jpg")
<SPAN style="color:darkblue">Call</SPAN> SendMail(MyPic1, MyPic2)
MyPic1.Delete: MyPic2.Delete
<SPAN style="color:darkblue">Set</SPAN> MyPic1 = Nothing: <SPAN style="color:darkblue">Set</SPAN> MyPic2 = <SPAN style="color:darkblue">Nothing</SPAN>
Application.ScreenUpdating = <SPAN style="color:darkblue">True</SPAN>
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN>

<SPAN style="color:darkblue">Private</SPAN> <SPAN style="color:darkblue">Sub</SPAN> SendMail(<SPAN style="color:darkblue">ByRef</SPAN> MyPic1 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, <SPAN style="color:darkblue">ByRef</SPAN> MyPic2 <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>)

<SPAN style="color:darkblue">Dim</SPAN> Notes <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, db <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, WorkSpace <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>
<SPAN style="color:darkblue">Dim</SPAN> UIdoc <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">Object</SPAN>, UserName <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">String</SPAN>, MailDbName <SPAN style="color:darkblue">As</SPAN> <SPAN style="color:darkblue">String</SPAN>

<SPAN style="color:darkblue">Set</SPAN> Notes = CreateObject("Notes.NotesSession")

UserName = Notes.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
    (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

<SPAN style="color:darkblue">Set</SPAN> db = Notes.GetDataBase(vbNullString, MailDbName)

<SPAN style="color:darkblue">Set</SPAN> WorkSpace = CreateObject("Notes.NotesUIWorkspace")
<SPAN style="color:darkblue">Call</SPAN> WorkSpace.ComposeDocument(, , "Memo")

<SPAN style="color:darkblue">Set</SPAN> UIdoc = WorkSpace.CurrentDocument
<SPAN style="color:darkblue">Call</SPAN> UIdoc.FieldSetText("SendTo", "John H Deere") <SPAN style="color:green">'Recipient</SPAN>
<SPAN style="color:darkblue">Call</SPAN> UIdoc.FieldSetText("Subject", "Pic Time")

<SPAN style="color:darkblue">Call</SPAN> UIdoc.GotoField("Body")
<SPAN style="color:darkblue">Call</SPAN> UIdoc.InsertText(WorksheetFunction.Substitute( _
    "Hey Buddy,@@Check out the pics eh!@@", _
    "@", vbCrLf))

MyPic1.Copy: <SPAN style="color:darkblue">Call</SPAN> UIdoc.Paste

<SPAN style="color:darkblue">Call</SPAN> UIdoc.InsertText(String(2, vbCrLf))

MyPic2.Copy: <SPAN style="color:darkblue">Call</SPAN> UIdoc.Paste

<SPAN style="color:darkblue">Call</SPAN> UIdoc.InsertText(Application.Substitute( _
    "@@Don<SPAN style="color:green">'t Be A Stranger,@Moi", "@", vbCrLf))</SPAN>
Application.CutCopyMode = <SPAN style="color:darkblue">False</SPAN>

<SPAN style="color:darkblue">Call</SPAN> UIdoc.Save(True, <SPAN style="color:darkblue">True</SPAN>)
<SPAN style="color:darkblue">Call</SPAN> UIdoc.Send(False)
<SPAN style="color:darkblue">Call</SPAN> UIdoc.<SPAN style="color:darkblue">Close</SPAN>

<SPAN style="color:darkblue">Set</SPAN> UIdoc = Nothing: <SPAN style="color:darkblue">Set</SPAN> WorkSpace = <SPAN style="color:darkblue">Nothing</SPAN>
<SPAN style="color:darkblue">Set</SPAN> db = Nothing: <SPAN style="color:darkblue">Set</SPAN> Notes = <SPAN style="color:darkblue">Nothing</SPAN>

<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>
 
Upvote 0
Works Great.

One thing.... How do I turn off the Lotus Notes Spell Checkerm just for this Macro ?


Ta

:bow:
 
Upvote 0
The other things I am not real clear on, is/are...

Attaching a Document.
Inserting a txt in the same directory as the jpgs.
I need to have a "pick up " txt file, because the comments vary day to day, but the rest of the guff is just the same.

And most mornings, I email the same thing two or more times.

At this point the Images are loading into the Macro file source ( My "dashboard" as it were), but the code looks like it deletes that anyway.

The Subject lines is the variable comment line.

essentially I am trying to meld the existing mail document, which is fine for emails in a basic sense, with the New macro which Definitely picks up the images, and Hopefully will pick up a txt file.


Ta Muchly.

:bow:
 
Upvote 0
Notes Brings Up a Spell Checker when Sending a message.
Is there a way to suppress the Spell Checker in Notes for the sending of Emails driven by this Macro.

Ta

:bow:
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top