Macro to Paste Picture in email body from Clipboard

Discussion in 'Microsoft Excel Programming' started by K, May 13, 2009.

  1. K

    K Guest

    Hi all, I want macro which can paste picture in email body from
    clipboard. I got macro below which works ok but I am not achiving
    what I want from it. Please can any friend can help

    Sub SendEmail()
    Range("A1:D20").CopyPicture xlScreen, xlPicture

    Dim OutApp As Object
    Dim OutMail As Object
    With Application
    ..EnableEvents = False
    ..ScreenUpdating = False
    End With

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next

    With OutMail
    ..To = ""
    '.CC = ""
    '.BCC = ""
    ..Subject = "Testing Email"


    ..HTMLBody = .Paste 'Something needed here
    ..Display

    End With
    On Error GoTo 0

    With Application
    .EnableEvents = True
    .ScreenUpdating = True
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing

    End Sub
     
    K, May 13, 2009
    #1
    1. Advertisements

  2. K

    Ron de Bruin Guest

    If you want a picture in your mail try this
    http://www.rondebruin.nl/mail/folder3/mailenvelope.htm


    --

    Regards Ron de Bruin
    http://www.rondebruin.nl/tips.htm




    "K" <> wrote in message news:...
    > Hi all, I want macro which can paste picture in email body from
    > clipboard. I got macro below which works ok but I am not achiving
    > what I want from it. Please can any friend can help
    >
    > Sub SendEmail()
    > Range("A1:D20").CopyPicture xlScreen, xlPicture
    >
    > Dim OutApp As Object
    > Dim OutMail As Object
    > With Application
    > .EnableEvents = False
    > .ScreenUpdating = False
    > End With
    >
    > Set OutApp = CreateObject("Outlook.Application")
    > OutApp.Session.Logon
    > Set OutMail = OutApp.CreateItem(0)
    >
    > On Error Resume Next
    >
    > With OutMail
    > .To = ""
    > '.CC = ""
    > '.BCC = ""
    > .Subject = "Testing Email"
    >
    >
    > .HTMLBody = .Paste 'Something needed here
    > .Display
    >
    > End With
    > On Error GoTo 0
    >
    > With Application
    > .EnableEvents = True
    > .ScreenUpdating = True
    > End With
    >
    > Set OutMail = Nothing
    > Set OutApp = Nothing
    >
    > End Sub
     
    Ron de Bruin, May 13, 2009
    #2
    1. Advertisements

  3. K

    K Guest

    On May 13, 2:53 pm, "Ron de Bruin" <> wrote:
    > If you want a picture in your mail try thishttp://www.rondebruin.nl/mail/folder3/mailenvelope.htm
    >
    > --
    >
    > Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
    >
    >
    >
    > "K" <> wrote in messagenews:...
    > > Hi all, I want macro which can paste picture in email body from
    > > clipboard.  I got macro below which works ok but I am not achiving
    > > what I want from it.  Please can any friend can help

    >
    > > Sub SendEmail()
    > > Range("A1:D20").CopyPicture xlScreen, xlPicture

    >
    > > Dim OutApp As Object
    > > Dim OutMail As Object
    > > With Application
    > > .EnableEvents = False
    > > .ScreenUpdating = False
    > > End With

    >
    > > Set OutApp = CreateObject("Outlook.Application")
    > > OutApp.Session.Logon
    > > Set OutMail = OutApp.CreateItem(0)

    >
    > > On Error Resume Next

    >
    > > With OutMail
    > > .To = ""
    > > '.CC = ""
    > > '.BCC = ""
    > > .Subject = "Testing Email"

    >
    > > .HTMLBody = .Paste  'Something needed here
    > > .Display

    >
    > > End With
    > >    On Error GoTo 0

    >
    > >    With Application
    > >        .EnableEvents = True
    > >        .ScreenUpdating = True
    > >    End With

    >
    > >    Set OutMail = Nothing
    > >    Set OutApp = Nothing

    >
    > > End Sub- Hide quoted text -

    >
    > - Show quoted text -


    Hi Ron, Thanks for replying. Please note i dont want picture in
    email body but i want to paste a picture in email body. Please advise
    me that what kind of changes i can do in you macro to achive this.
    There is no good sultion out there to get code to paste picture in
    email body. its easy to put picture from a path into email body but
    how can i paste something on clipboard to email body by excel macro.
    Please help
     
    K, May 13, 2009
    #3
  4. K

    Ron de Bruin Guest

    Hi K

    I have no example for this for you on this moment.
    Sorry I have no time on this moment to create/test a example for you


    --

    Regards Ron de Bruin
    http://www.rondebruin.nl/tips.htm




    "K" <> wrote in message news:...
    On May 13, 2:53 pm, "Ron de Bruin" <> wrote:
    > If you want a picture in your mail try thishttp://www.rondebruin.nl/mail/folder3/mailenvelope.htm
    >
    > --
    >
    > Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
    >
    >
    >
    > "K" <> wrote in messagenews:...
    > > Hi all, I want macro which can paste picture in email body from
    > > clipboard. I got macro below which works ok but I am not achiving
    > > what I want from it. Please can any friend can help

    >
    > > Sub SendEmail()
    > > Range("A1:D20").CopyPicture xlScreen, xlPicture

    >
    > > Dim OutApp As Object
    > > Dim OutMail As Object
    > > With Application
    > > .EnableEvents = False
    > > .ScreenUpdating = False
    > > End With

    >
    > > Set OutApp = CreateObject("Outlook.Application")
    > > OutApp.Session.Logon
    > > Set OutMail = OutApp.CreateItem(0)

    >
    > > On Error Resume Next

    >
    > > With OutMail
    > > .To = ""
    > > '.CC = ""
    > > '.BCC = ""
    > > .Subject = "Testing Email"

    >
    > > .HTMLBody = .Paste 'Something needed here
    > > .Display

    >
    > > End With
    > > On Error GoTo 0

    >
    > > With Application
    > > .EnableEvents = True
    > > .ScreenUpdating = True
    > > End With

    >
    > > Set OutMail = Nothing
    > > Set OutApp = Nothing

    >
    > > End Sub- Hide quoted text -

    >
    > - Show quoted text -


    Hi Ron, Thanks for replying. Please note i dont want picture in
    email body but i want to paste a picture in email body. Please advise
    me that what kind of changes i can do in you macro to achive this.
    There is no good sultion out there to get code to paste picture in
    email body. its easy to put picture from a path into email body but
    how can i paste something on clipboard to email body by excel macro.
    Please help
     
    Ron de Bruin, May 13, 2009
    #4
  5. paste doesn't work. with the picture, save it to your local drive, then
    link it to the mail as suggested in Ron's reply

    "Ron de Bruin" <> wrote in message
    news:ulePdk#...
    > Hi K
    >
    > I have no example for this for you on this moment.
    > Sorry I have no time on this moment to create/test a example for you
    >
    >
    > --
    >
    > Regards Ron de Bruin
    > http://www.rondebruin.nl/tips.htm
    >
    >
    >
    >
    > "K" <> wrote in message
    > news:...
    > On May 13, 2:53 pm, "Ron de Bruin" <> wrote:
    >> If you want a picture in your mail try
    >> thishttp://www.rondebruin.nl/mail/folder3/mailenvelope.htm
    >>
    >> --
    >>
    >> Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
    >>
    >>
    >>
    >> "K" <> wrote in
    >> messagenews:...
    >> > Hi all, I want macro which can paste picture in email body from
    >> > clipboard. I got macro below which works ok but I am not achiving
    >> > what I want from it. Please can any friend can help

    >>
    >> > Sub SendEmail()
    >> > Range("A1:D20").CopyPicture xlScreen, xlPicture

    >>
    >> > Dim OutApp As Object
    >> > Dim OutMail As Object
    >> > With Application
    >> > .EnableEvents = False
    >> > .ScreenUpdating = False
    >> > End With

    >>
    >> > Set OutApp = CreateObject("Outlook.Application")
    >> > OutApp.Session.Logon
    >> > Set OutMail = OutApp.CreateItem(0)

    >>
    >> > On Error Resume Next

    >>
    >> > With OutMail
    >> > .To = ""
    >> > '.CC = ""
    >> > '.BCC = ""
    >> > .Subject = "Testing Email"

    >>
    >> > .HTMLBody = .Paste 'Something needed here
    >> > .Display

    >>
    >> > End With
    >> > On Error GoTo 0

    >>
    >> > With Application
    >> > .EnableEvents = True
    >> > .ScreenUpdating = True
    >> > End With

    >>
    >> > Set OutMail = Nothing
    >> > Set OutApp = Nothing

    >>
    >> > End Sub- Hide quoted text -

    >>
    >> - Show quoted text -

    >
    > Hi Ron, Thanks for replying. Please note i dont want picture in
    > email body but i want to paste a picture in email body. Please advise
    > me that what kind of changes i can do in you macro to achive this.
    > There is no good sultion out there to get code to paste picture in
    > email body. its easy to put picture from a path into email body but
    > how can i paste something on clipboard to email body by excel macro.
    > Please help
     
    Patrick Molloy, May 13, 2009
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    692
  2. Marie J-son
    Replies:
    0
    Views:
    353
    Marie J-son
    Feb 8, 2006
  3. tskogstrom

    Restore clipboard from Task pane clipboard content?

    tskogstrom, Jan 30, 2007, in forum: Microsoft Excel Programming
    Replies:
    0
    Views:
    355
    tskogstrom
    Jan 30, 2007
  4. tskogstrom
    Replies:
    2
    Views:
    880
    tskogstrom
    Mar 6, 2007
  5. Paul Morgan
    Replies:
    3
    Views:
    1,007
Loading...

Share This Page