Results 1 to 8 of 8

Thread: reference current slected attachment of an email

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    80

    Smile reference current slected attachment of an email

    hi again

    if my terminology is a little wrong, then please excuse me

    i have the following code which registers inspector events with newly created items so i can use thier events

    Code:
    Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    
    Set objInsp = Inspector
    
    Select Case objInsp.CurrentItem.Class
        Case olMail
            Set objMailItem = objInsp.CurrentItem
        Case olAppointment
            Set objApptItem = objInsp.CurrentItem
        Case olContact
            Set objContactItem = objInsp.CurrentItem
        Case olDistribution
            Set objDistListItem = objInsp.CurrentItem
        Case olJournal
            Set objJournalItem = objInsp.CurrentItem
        Case olPost
            Set objPostitem = objInsp.CurrentItem
        Case olTask
            Set objTaskItem = objInsp.CurrentItem
            
    End Select
    
    End Sub
    i also declare the holding objects (omailitem) with events, anyhow it works ok

    one of these is the omailitem_open event which i add a few buttons to the tool bar of a new email.

    one of these buttons is then used to digitally seal the attached document with our java classes. Integration with this ia done

    what i need to know, is how to reference the a selected attachment from within oMailItem object

    is there an event like oAttachmentSelection, so that i can capture the item selected.

    many thanks

    jamie

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

    Re: reference current slected attachment of an email

    You would use the .Attachments collection of a MailItem object.
    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
    Lively Member
    Join Date
    Jan 2006
    Posts
    80

    Re: reference current slected attachment of an email

    hi there

    thanks for the response

    i know how to reference the attachments collection, but what i need to know, is how to reference the event of an attachment selection to capture the id of the selected attachment, whihc i woul then use to reference it in the attachment collection (after saving the new mail)

    i have read since posting this that attachments are added using the lcip board and that vb cannot access these files as it cannot access the clip board functions (sorry, on another pc, cant provide a link at thsi time)

    the only other alternaitve which i have found, is a drag and drop dll, which allows you to drag the required attachment onto the control, which then uses a c++ ocx to access the file properties on the clip board.

    bu if any one knows a different way then i woudl love to know

    jamie

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

    Re: reference current slected attachment of an email

    If the email is already a saved one, you may be able to create a ItemChange event. Not sure if it will fire for each attachment added or only when its saved.
    VB Code:
    1. Public WithEvents AttachItems As Items
    2. 'Sync the item to AttachItems
    3.  
    4. 'Then you can use its event.
    5. Private Sub AttachItems_ItemChange(ByVal Item As Object)
    6.  
    7. End Sub
    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    80

    Re: reference current slected attachment of an email

    cheers,

    but can this be done with new emails?

    i may have to get the user to first save the emial, then choose an attachment, but that is going to be a problem with the client

    jamie

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

    Re: reference current slected attachment of an email

    I'm not sure. You will probably have to test it to see.
    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

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    80

    Re: reference current slected attachment of an email

    cheers,

    i will test it once i have sorted all of my other problems, phew

    many thanks

    jamie

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

    Re: reference current slected attachment of an email

    No problem. Could you post back with your findings so we will know too?
    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

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