?
Solved

codes to insert image in outlook

Posted on 2006-11-09
6
Medium Priority
?
258 Views
Last Modified: 2012-05-07
Hi all,

Under here is the codes for formatting and send out the mail. Everything is almost done EXCEPT the inserting of logo image to my mail body. I managed to find the codes on the net but after testing it is what i sort of wanted but I need slight modification. Please help...

Under the AddInfo(), it contains all the info I want in the body which will be printed out in text. Under the item_send() function, I need to have it printed out in
the picture2.jpg
then the greetings which is actually strMeseage. but it seems to be unable to display out the picture and strMessage and

How do I combine the picture with the strMessage body under the Item_Send()? Or shld I do the display in the strMessage? Help Help...

And it also seems these 2 objects are driving me crazy cos it opens up new mail..i do not want that..how to solve it?
Set objOL = CreateObject("Outlook.Application") <-----------------
Set objMail = objOL.CreateItem(olMailItem)<----------------------

Here are the codes..

=======================================
Function AddInfo()
     dim dept
     Set fmCtl = Item.GetInspector.ModifiedFormPages("Message").Controls("CardFormCtl1")
      dept = fmCtl.DeptName

        If dept <> "" Then
                strMessage = "Dear Clients & Friends" & vbCrLf _
                & vbCrLf _
                & "Season's greetings" & vbCrLf _
                & vbCrLf _
                & "Best regards" & vbCrLf _
                &  vbCrLf _
                & dept & vbCrLf _
            AddInfo = True
           Else
            AddInfo = False
           End If
     
     Set fmCtl = Nothing
End Function


Function Item_Send()
      Set objOL = CreateObject("Outlook.Application") <-----------------
          Set objMail = objOL.CreateItem(olMailItem)<---------------------- I don't need to create another new mail
          objMail.Attachments.Add "C:\picture2.jpg"
          objMail.HTMLBody = "<html><p>This is a picture.</p>" & _
                   "<img src='cid:picture2.jpg' height=50 width=500></p></html>"
      objMail.body = strMessage
      objMail.Display

       'If AddInfo() = True then
       'Item.subject = "Christmas Card"
       'Item.body = strMessage
       'Item.MessageClass = "IPM.Note"
       'end if

End Function
===========================================



0
Comment
Question by:Yannie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 6

Expert Comment

by:saravananvg
ID: 17905250
0
 

Author Comment

by:Yannie
ID: 17906489
Hmm it's almost the same..
now is i'm trying to consolidate..

I also had the objects created here..
Set objOL = CreateObject("Outlook.Application") <-----------------
         Set objMail = objOL.CreateItem(olMailItem)<----------------------  

If i dun use.createItem(), can i?
0
 

Author Comment

by:Yannie
ID: 17912024
If i juz want to make it send out together under as objMail.send instead and remove item_send() is dat possible?
0
 

Author Comment

by:Yannie
ID: 17943717
Ok I got it solved .

I can choose to

Item.Attachments.Add "c:\emailmasthead2.jpg"
Item.HTMLBody = "<html><img src='cid:emailmasthead2.jpg' height=50 width=500><p></html>"
Or      
Item.HTMLBody = "<html><img src='http://www.thisismysite.com/emailmasthead2.jpg' height=50 width=500><p></html>"

both works!
0
 
LVL 1

Accepted Solution

by:
kodiakbear earned 0 total points
ID: 17984062
Closed, 500 points refunded.
kb
Experts Exchange Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question