|
-
Oct 21st, 2017, 02:15 AM
#1
Thread Starter
New Member
vb code for Sending email using reportviewer via Ms-outlook 2007
I have created a following vb-code for Sending email message to recipients, but it showing error as - 'CreateItem' is not a member of 'System.Windows.Forms.Application' and 'Session' is not a member of 'System.Windows.Forms.Application'. Please help to get rid of this error..Thanks in Advance
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SendEmail()
End Sub
Private Sub SendEmail()
Dim mail As Outlook.MailItem = CType(Application.CreateItem(Outlook.OlItemType.olMailItem), _ Outlook.MailItem)
mail.Subject = "Quarterly Sales Report FY06 Q4"
Dim currentUser As Outlook.AddressEntry = Application.Session.CurrentUser.AddressEntry
If currentUser.Type = "EX" Then
Dim manager As Outlook.ExchangeUser = _
currentUser.GetExchangeUser().GetExchangeUserManager()
' Add recipient using display name, alias, or smtp address
mail.Recipients.Add(manager.PrimarySmtpAddress)
mail.Recipients.ResolveAll()
mail.Attachments.Add("c:\Daily Diesel Consumption Truck.xls", _ Outlook.OlAttachmentType.olByValue)
mail.Send()
End If
End Sub
..........................
Actually I want to add that "Email" Tab in ReportViewer where I can send email with attachement file ... Please guide me...Thanks again.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|