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

VBA Clipboard Cut & Paste from Excel to Outlook



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old January 29th 07, 12:47 AM posted to microsoft.public.outlook.program_vba
andy
external usenet poster
 
Posts: 122
Default VBA Clipboard Cut & Paste from Excel to Outlook

An unusual one this one but please read on.

If I manually copy a range of cells from an Excel worksheet and then paste
into a Draft email in Outlook (My Outlook 2003 uses HTML as draft format with
Word as editor) the resulting pasted cells look fine - colors and formatting
are maintained.

OK now to do it in VBA from Excel.

I copy the range of cells into Clipboard with :-

Range(Cells(aa, 4), Cells(bb, 17)).Select
Selection.Copy

I then obtain the contents of Clipboard and place into a String variable
with :-

Set MyData = New DataObject

MyData.GetFromClipboard
strClip = MyData.GetText

I then create an Outloook object within VBA and build a Draft message using
strClip as part of the Message body.

This all works OK and the Draft message is created but the resulting pasted
range of cells in the Draft message does not look very good, the values are
mis-aligned and wrapped around with any color formatting is lost. It does not
give me the same pretty result as manually cutting and pasting the cells.

Does anyone know how I can preserve the formatting using the VBA method so
that the resulting pasted cells looks as good as the manual method?

Thanks.




 




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
Clipboard gets empty by itself, cleared clipboard, copy paste doesn't work, outlook clears clipboard, problems with clipboard - possible solution Jens Hoerburger Outlook - General Queries 0 August 24th 06 02:44 PM
HTML cut-and-paste bug [email protected] Outlook and VBA 0 April 20th 06 03:26 PM
Cut & Paste Outlook Display Names Into To Field Display As ; PJ Outlook - Using Contacts 0 March 9th 06 04:16 PM
Cut and Paste Outlook and all settings BEEJAY Outlook - Installation 1 March 5th 06 10:31 PM
Outlook should allow cut and paste when creating message rules. exflier Outlook - General Queries 1 January 18th 06 03:14 PM


All times are GMT +1. The time now is 03:38 PM.


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.