![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am trying to paste an excel shart in the body of an outlook message.
I already managed to do this through exporting the chart and then importing, but the chart loses a lot of quality so I am trying to find a way to paste the chart through the clipboard. the only thing missing in my code would be the procedure to paste the chart that is already on the clipboard. here's what I have: Sub SendEmail() Dim theApp, theNameSpace, theMailItem, myAttachment, Msg 'create a new Outlook Application Object, 'direct it to the proper NameSpace, 'create a new Mail Item and set the attachments collection Set theApp = CreateObject("Outlook.Application") Set theNameSpace = theApp.GetNamespace("MAPI") Set theMailItem = theApp.CreateItem(0) Set myAttachment = theMailItem.Attachments theMailItem.Display ' campo mensagem ' Workbooks.Open "Test.xls" Sheets("Sheet1").Select ActiveSheet.ChartObjects("Grafico").Activate ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture Sheets("Sheet1").Cells(1, 1).Select 'add recipients to MailItem theMailItem.Recipients.Add " theMailItem.subject = "Anything" theMailItem.Body = Msg theMailItem.Send theNameSpace.Logoff End Sub I found the code below on this same newsgroup that supposedly would do the job, but it is not working. Does anyone know why? Sub Pastebody() Set tmpBody = Item.GetInspector.ModifiedFormPages("Message").Con trols("Message") tmpBody.SetFocus Item.GetInspector.CommandBars.Item("Menu Bar").Controls("Edit").Controls("Paste").Execute End Sub Thanks |
Ads |
#2
|
|||
|
|||
![]()
Am 26 Sep 2006 14:55:53 -0700 schrieb :
The problem is that with the Outlook object model you canīt set the focus to the body window. With Redemption (www.dimastr.com) that works. Once you know that the body has the focus you can get the Insert button from the commandbar (ID=22) and call its Execute method. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- I am trying to paste an excel shart in the body of an outlook message. I already managed to do this through exporting the chart and then importing, but the chart loses a lot of quality so I am trying to find a way to paste the chart through the clipboard. the only thing missing in my code would be the procedure to paste the chart that is already on the clipboard. here's what I have: Sub SendEmail() Dim theApp, theNameSpace, theMailItem, myAttachment, Msg 'create a new Outlook Application Object, 'direct it to the proper NameSpace, 'create a new Mail Item and set the attachments collection Set theApp = CreateObject("Outlook.Application") Set theNameSpace = theApp.GetNamespace("MAPI") Set theMailItem = theApp.CreateItem(0) Set myAttachment = theMailItem.Attachments theMailItem.Display ' campo mensagem ' Workbooks.Open "Test.xls" Sheets("Sheet1").Select ActiveSheet.ChartObjects("Grafico").Activate ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture Sheets("Sheet1").Cells(1, 1).Select 'add recipients to MailItem theMailItem.Recipients.Add " theMailItem.subject = "Anything" theMailItem.Body = Msg theMailItem.Send theNameSpace.Logoff End Sub I found the code below on this same newsgroup that supposedly would do the job, but it is not working. Does anyone know why? Sub Pastebody() Set tmpBody = Item.GetInspector.ModifiedFormPages("Message").Con trols("Message") tmpBody.SetFocus Item.GetInspector.CommandBars.Item("Menu Bar").Controls("Edit").Controls("Paste").Execute End Sub Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
comparison chart for OE vs Outlook vs ? | Pamela G. | Outlook Express | 1 | July 16th 06 01:54 AM |
extracting mailitem.body text to Excel columns | Junoon | Outlook and VBA | 3 | April 20th 06 06:45 AM |
Paste cells from Excel into message body | goshute | Outlook and VBA | 1 | March 29th 06 07:02 AM |
Tough One - Update Pivot Chart in Access Report using VBA? | jer99 | Outlook and VBA | 2 | January 19th 06 11:29 PM |