Hi Expers,
I want to copy and paste an excel pivot table (that is autogenerated using powershell) to body of the email without loosing the format, color coding. I am able to get it on to the body of email. But the output is not formatted in the body of the email. If i do the same paste on to another excel sheet. the copy works fine. i have tested that. But when pasted to body of email, it comes as plain text. Here is my code.. (piece of it for sending email)
$rgeSource=$ws3.range("A2","E11")
$rgeSource.copy() | out-null
$worksheet2.range("M1","Q10").pasteSpecial(-4104)
Set-StrictMode -Version Latest
PowerShell -NoProfile -STA -Command {
add-type -an system.windows.forms
$xDate = (Get-Date -format "MM/dd/yyyy")
Add-Type -Assembly PresentationCore
[System.Windows.Forms.Clipboard]::GetText()
$oLook = New-Object -comObject Outlook.Application
$mail = $oLook.CreateItem(0)
$mail.Recipients.Add('user1@contoso.com') | Out-Null
$mail.Subject = "Tracking Implementation Tasks : $xDate"
$mail.HTMLBody = [System.Windows.Forms.Clipboard]::GetText()
$mail.Send()
$mail |gm
}
much appreciate your help
thanks
Helen
SQL Server DBA