none
Dialog to select mail itens from a folder with VBA RRS feed

  • Question

  • Hi all,

    can someone tell me how to get / make / use a dialog to select mail item's from a folder with VBA.

    I'm looking for something like the namespace.PickFolder Dialog but to "pick" mail itens.

    I have idea that I already saw something like this ... but I'm getting old and don't recall where :(

    TIA

    João

     

     

    Wednesday, January 11, 2012 7:30 PM

Answers

All replies

  • There is no such dialog; you would need to build one yourself.

    Why not use the regular Explorer object and its Selection collection?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Wednesday, January 11, 2012 7:37 PM
  • Dmitry,

    Thanks for replying.

    I have to create a feature to access an application that allows the user to specify an email, in his Inbox, which I then must identify and use it in my code.


    Basically to create a file of olmsg type nd store it in an ole field in a table.

    I have code to browse the Inbox and display the mail itens in listbox control for the user to select one of the mail itens...

    I'm trying to save time and not be reinventing the wheel ... again ...

    And do not have much experience in VBA for Outlook :(

    When say regular Explorer object you are talking about the Outlook.Application.ActiveExplorer ?

    João

     

     


    Wednesday, January 11, 2012 8:17 PM
  • Well the solution to my problem might be the Outlook View Control... I hope.

    João

    Thursday, January 12, 2012 1:11 PM
  • If your code was a COM add-in, you could just add a button that will fire up your code that would operate on whatever is currently selected in Outlook without an extra step of having to select a message since you already would have a context.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Thursday, January 12, 2012 4:32 PM
  • Et Outlook:

     Do
     Set oFolder = olNS.PickFolder
     If oFolder  Is Nothing Then Exit Sub
    
     If  oFolder.DefaultItemType <> 0 Then
     MsgBox  "bla bla bala", vbExclamation, " Informacja o błędzie VBATools.pl"
     Set  oFolder = olNS.GetDefaultFolder(olFolderOutbox)
     Else
     bExitFor = True
     End  If
     Loop While Not bExitFor
    
     Set  oFolder = olNS.GetFolderFromID(oFolder.EntryID,  oFolder.StoreID)
    
    This is a Article: Move messages sent and received to the designated folder

     

    Et Excel:

    Dim Wybor As FileDialog, file
    Set Wybor = Application.FileDialog(msoFileDialogFolderPicker)
    With Wybor
     .AllowMultiSelect = True
     .Title = "Wybierz katalog docelowy"
     .InitialFileName = ThisWorkbook.path
     .Show
     On Error GoTo blad
     file = .SelectedItems(1)
     On Error GoTo 0
    End With
    If file <> "" Then
    
    This is a Article: Create a text script files

    I hope this help.

    If you want use Googletranslate or another to your lang.

    Regards


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    Thursday, January 12, 2012 10:36 PM
  • The solution wasn't the OVC outlook view control :(

    From what I've read It seems doesn't work very well with Access 2007 and Outlook 2007...

    The solution after pickfolder was to get the messages to a table and make a form and subform to expose them and so on....

    My problem now is to get a control that can all the htmlbody, because the textbox in richtext doesn't display everything from the messages....

    Reinventing the wheel :(

    Thanks anyway.

    João.

     

     

    Friday, January 13, 2012 8:17 PM