A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Annoying as H#LL !!!!



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old June 21st 06, 12:14 PM posted to microsoft.public.outlook.program_vba
WhytheQ
external usenet poster
 
Posts: 21
Default Annoying as H#LL !!!!

I'm trying to do something which surely isn't that difficult!

It will be part of a macro in Excel and what I want to do is copy a
range from the activesheet and then paste this into the body of an
Outlook e-mail.Here's the code:

Private OutApp As Object
Private OutMail As Object
Private NS As Object

Sub UpdateMail()

Application.screenupdating = False
Application.EnableEvents = False

'put info on the clipboard
ThisWorkbook.Sheets("Pivots").Range("B5:C6").Copy
'


Call OpenOutlook

Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = "Tester"
.Subject = "Solve this one"

'take info from the clipboard
.body = ClipBoard.GetText
'

.Display
End With

Set OutMail = Nothing
Set OutApp = Nothing
Set NS = Nothing

Application.screenupdating = true
Application.EnableEvents = True

End Sub


Private Function OpenOutlook()
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
If Err.Number = 429 Then
Set OutApp = CreateObject("Outlook.Application")
Set NS = OutApp.GetNamespace("MAPI")
NS.Logon
End If
On Error GoTo 0
End Function


I'm happy that the copy method in Excel moves the info to the clipboard
but how do I extract it and paste it into the body of the mail.

Any help greatly appreciated
Jason

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Annoying Outlook Calendar problem Anders Biro Outlook - General Queries 5 April 27th 06 05:27 PM
Annoying Popup while Deleting NG threads Raoul Outlook Express 5 April 1st 06 11:32 AM
Annoying telephone number formatiing Alphonse Outlook - Installation 4 April 1st 06 06:24 AM
Annoying Little Yellow Box Leonard M. Wapner Outlook Express 3 March 19th 06 02:22 AM
Annoying Message shows Bob Outlook - General Queries 3 February 11th 06 08:20 PM


All times are GMT +1. The time now is 05:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.