Results 1 to 9 of 9

Thread: Convert RPT to PDF and send it in email

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    7

    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:
    1. Dim mOutLookApp As Outlook.Application
    2. Dim mNameSpace As Outlook.Namespace
    3. Dim mItem As Outlook.MailItem
    4.  
    5. Set mOutLookApp = New Outlook.Application
    6. Set mNameSpace = mOutLookApp.GetNamespace("MAPI")
    7. mNameSpace.Logon , , False, True
    8.  
    9.     Set mItem = mOutLookApp.CreateItem(olMailItem)
    10.     mItem.To = strEmailAddress
    11.     mItem.Subject = "This is for you"
    12.     mItem.HTMLBody = strMessage
    13.    
    14.     mItem.Sensitivity = olConfidential
    15.     mItem.Importance = olImportanceHigh
    16.    
    17.     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.
    Last edited by RobDog888; Sep 12th, 2005 at 11:19 PM. Reason: Added vbcode tags

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    7

    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

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Convert RPT to PDF and send it in email

    Are you doing your coding in VB or Outlook VBA?

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    7

    Re: Convert RPT to PDF and send it in email

    I'm doing the coding in VB6. Not the Outlook.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Convert RPT to PDF and send it in email

    Moved from Classic VB forum.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    7

    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?!

  9. #9

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    7

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width