Results 1 to 4 of 4

Thread: Controls in a Class

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    1

    Controls in a Class

    I am trying to make a Class to send a simple email using MAPI. I can do it with a form, but I can't figure out how to do it with a class. What do you have to add in the class since you can't drag and drop the MAPISession and MAPIMessages Controls onto the class like you can the form?

    Here is the code that works when its not in a class.
    Code:
        
        MapiSession1.SignOn
        MAPIMessages1.SessionID = MapiSession1.SessionID
        MAPIMessages1.Compose
        MAPIMessages1.RecipDisplayName = m_MailTo
        MAPIMessages1.MsgSubject = m_MailSubject
        MAPIMessages1.MsgNoteText = m_MailMessage
        MAPIMessages1.ResolveName
        MAPIMessages1.Send
    Thanks in advance.

  2. #2

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

    I think you may be asking this question because you dont
    need/want to show a form and if so, you could use a form but set
    its visibility property to false.

    HTH
    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

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Instantiate the class, call its functions which encapsulate the code you've pasted above, pass the right parameters. Almost the same thing.

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