image - How to send a shape object from Excel in the body of an Email? -


i'm struggling 1 (seemingly) simple step in macro i'm trying write. have excel shape object i'm trying copy paste outlook mail item. shape object product of using excel's "camera tool." did created chart need flip 90 degrees viewing. camera tool makes simple. problem have pasting picture shape outlook item. suggestions?

here's code far:

sub emailer()  dim wb workbook dim ws worksheet dim p shape dim o outlook.application dim om outlook.mailitem dim rec outlook.recipient dim recs outlook.recipients  'create outlook session set o = createobject("outlook.application") 'create message set om = o.createitem(olmailitem) set recs = om.recipients set rec = recs.add("email@email.com") rec.type = 1  set wb = activeworkbook set ws = activeworkbook.worksheets("chart_pic")  set p = ws.shapes("picture 2") p.copypicture   om .sentonbehalfofname = "email@email.com" .subject = "subject" .htmlbody = "this test" & vbcrlf & vbcrlf & [where want shape go]   each rec in om.recipients rec.resolve next  om.send  end  set o = nothing 

you use clipboard copy/paste picture. need outlook mail editor can deal clipboard. wordeditor example.

example:

sub emailer()   set oolapp = createobject("outlook.application")   set oolmitem = oolapp.createitem(olmailitem)   set owb = activeworkbook  set ows = activeworkbook.worksheets("chart_pic")   set opic = ows.shapes("picture 2")  opic.copypicture ' opic in clipboard    oolmitem    .display    .to = "email@email.com"   .subject = "subject"    set oolinsp = .getinspector   set owddoc = oolinsp.wordeditor ' word document mailbody    set owdcontent = owddoc.content   owdcontent.insertparagraphbefore   set owdrng = owddoc.paragraphs(1).range   owdrng.insertbefore "this test"   owdrng.insertparagraphafter   owdrng.insertparagraphafter    set owdrng = owddoc.paragraphs(3).range   owdrng.paste ' paste opic clipboard    olformathtml = 2   .bodyformat = olformathtml ' change html    end  end sub 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -