Convert RPT to PDF and send it in email
Hi,
I want to convert my report to a pdf format and send it via email...I'm using the outlook application and i searched for codes to how to send email and got this code:
VB Code:
Dim mOutLookApp As Outlook.Application
Dim mNameSpace As Outlook.Namespace
Dim mItem As Outlook.MailItem
Set mOutLookApp = New Outlook.Application
Set mNameSpace = mOutLookApp.GetNamespace("MAPI")
mNameSpace.Logon , , False, True
Set mItem = mOutLookApp.CreateItem(olMailItem)
mItem.To = strEmailAddress
mItem.Subject = "This is for you"
mItem.HTMLBody = strMessage
mItem.Sensitivity = olConfidential
mItem.Importance = olImportanceHigh
mItem.Send
I got compile error in line one (mOutLookApp )that the user-defined type is not defined!!
How can i solve the problem?!!!
Please help me. :confused:
Re: Convert RPT to PDF and send it in email
Welcome to the Forums. :)
Add a reference to MS Outlook xx.0 Object Library
But as you stated, your doing this behind Outlook in VBA?
Re: Convert RPT to PDF and send it in email
hi,
how can i Add a reference to MS Outlook xx.0 Object Library?I don't wanna change the outlook cuz the ssytem will be based on a server.
My questions are:
1)How can i convert the report from rpt to pdf mode?
2)How can i send the report (use the outlook email as sender mail and a propmt box asking for reciever email)?
I hope you got the question right now:)
thanks
Re: Convert RPT to PDF and send it in email
Are you doing your coding in VB or Outlook VBA?
Re: Convert RPT to PDF and send it in email
I'm doing the coding in VB6. Not the Outlook.
Re: Convert RPT to PDF and send it in email
What version of Outlook is on the server? If you add a reference to Outlook in you Project > Components > Controls tab > select "MS Outlook xx.0 Object Library" it will need to be the same version as on the server or you will need to use Late Binding to allow for the variation of Outlook versions. ;)
Re: Convert RPT to PDF and send it in email
Moved from Classic VB forum. :)
Re: Convert RPT to PDF and send it in email
Hi,
in:
Project > Components > Controls tab > I don't have "MS Outlook xx.0 Object Library" Instead i have "Microsoft Office Outlook View Control"
What shall i do?!
Re: Convert RPT to PDF and send it in email
Now i can send the email but how can i send the report:
----------------------------
Dim olAppt As Outlook.AppointmentItem
Set olAppt = olApp.CreateItem(olAppointmentItem)
----------------------------
...I got an error in this line:
olAppt .Attachments = rptATMCardAppli
(the error msg is: Run Time Error '-2147352567(80020009) Property is read only)