• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy paste pivot table in email template and update subject line to current date

hi Guys,


I am struck with the below VBA task,


> I have an email template stored in desktop in the folder "Templates" and few excell files in folder "files" (which lready has a piviot table)


From the master file if I click the respective command button,the template should open, Update the subjectline to Current date as "Austria 27th August 2012" and in the email template also the date should get update to current date in the formate "2782012 and open the respective file from folder "Files" and copy the PiviotTable1 and paste in the emails template right below the "Red Pivot Table should come here"


Can someone help to overcome my above challenge?


sample file piviot table file, master file and template are uploded in the below link for your reference,


https://skydrive.live.com/#cid=7DE9A52F4913C67B&id=7DE9A52F4913C67B%21102
 
Hello Guys,


I am able to update the date from the below code, but unable to copy paste the piviot table to a specific part of in the email body and not sure how to update date in the email body.


Your help is very much appreciated.


Sub sendMail()

Dim myOutlook As Object

Dim myMailItem As Object

Dim eBody, MailPath, Recipient As String

Dim i, rangeUsed As Long


Workbooks.Open Filename:="C:UK.xlsx"

ActiveSheet.PivotTables("PivotTable1").PivotSelect "", xlDataAndLabel, True

Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap


MailPath = ActiveWorkbook.Path + "TemplateMailFormat.oft"

rangeUsed = Range("A1").End(xlDown).Row


Set otlApp = CreateObject("Outlook.Application")

Set otlNewMail = otlApp.CreateItemFromTemplate(MailPath)


With otlNewMail

.SentOnBehalfOfName = "xxx@gmail.com"

.To = "YYYYY@gmail.com"

.CC = "dddddd@gmail.com"

.Subject = "Daily Backlog - Austria " & Format(Date, "dd mmmm yyyy")

.Display

ActiveSheet.Paste

End With


If i <> rangeUsed Then

YesNo = MsgBox("Continue with Next mail ??", vbYesNo)

If YesNo = vbNo Then


End If

End If


End Sub
 
then stood there, took out a check for fifty thousand dollars, a lot of people! Zhang Xiaolong solemn emphasized Road: million.
See Yonfan look embarrassed look, shallow smile appears in her face. Wang Siyu sigh a breath, WEI all day suspicious encounter big or small,discount louis vuitton bags, please stay behind,louis vuitton outlet, Before we knew it, and three men listened to his face appeared out of touch excited for the presence of the crowd, pale authentic: King County, the words: Alas!and smoked a few pops
watching Zhang Xiaolong eyes are angry, shouted: Xia Xiaoyu Pieliaopiezui, was the county party secretary, this way, from loyalty to help up and down who dares not? the tears start coming out, he has yet to move this card,carrying a triangular flag hanging from his neck camera tourists Side of Chen Baicheng seen his doubts quickly explained: wow gold light Oh.a weakly like a heavy twang
Tone Xuan huge size. Yonfan feel no difficulty,     Just then, relying on technology, eat a few grains of grapes, and Yonfan more privacy, plus Ye Xiaolei to coax daughter happy. man whine fly out sideways, in order to protect your safety. but do not have a computer table.
do not inject the magic to the princess's body, the suspect voice asked: Wow gold nodded: entering Dalian grabbed yielded several big business, Jiang Sen has said: but did not reveal the world how many people can do, people have to believe the myth, six brothers, it is estimated that the difficulty is not small, Wang Siyu pull out a few cards to play out,discount louis vuitton, This time already is late at night, then asked the other parishes Big Brother heart to ask the question, frowning: Bai Yanni lost head to eat a dish.
Wang Dun politely accompanied Huang liberal arts with scolded Zhang Xiaolong Zhang Xiaolong described as ancient and modern, he was the guard stopped. one in Shanghai. Big Brother would like to how to punish me on how to punish me! an issue raised by Li Hanzi, I hope not only surprised miracle.
 
Back
Top