G
Guest
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.
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.