Results 1 to 11 of 11
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365

    Return active email address


    Hi guy's is there a method to return the current active email address ?

    ie: if an email is minimized from Joe Bloggs

    MsgBox(joebloggs@home.com)

    If an email is active from Fred Bloggs

    MsgBox(fredbloggs@home.com)

    Etc

    I have nothing to go off at present, just wanted to know if there is an easy way to return the current active email address ?

    Kindest

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Hi Dave,

    You might want to check out the ActiveInspector:
    https://docs.microsoft.com/en-us/off...ctiveinspector

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I have code than can get properties of email selected in Outlook Inbox. No idea how to address minimized mail item.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Thank you guy's i have tried the following but probably without fully understanding, I guess regardless if an active email is maximized or minimized to task bar, i am trying to retrieve the email address from that active mail

    Taken from Vlad's link and i have added mail recip in there, i am getting an error saying method or data member not found

    Code:
     Dim myinspector As Outlook.Inspector 
     Dim myItem As Outlook.MailItem
     Dim myRecip As Outlook.Recipient
     
     Set myinspector = Application.ActiveInspector
     Set myItem = myinspector.CurrentItem
     Set myRecip = myItem.Recipients
        MsgBox (myRecip)
     myItem.Close olSave
    Click image for larger version. 

Name:	Capture3.JPG 
Views:	17 
Size:	30.5 KB 
ID:	45979

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    That is because Application in your context refers to the Access application. You need to declare an OutApp variable (Dim OutApp as Outlook.Application), initialize it
    Code:
     Set OutApp = CreateObject("Outlook.Application")
    and use that on that line:
    Code:
    Set myInspector=OutApp.ActiveInspector
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Cheers Vlad, run time error51 object variable or with block variable not set ?

    Code:
     Dim myinspector As Outlook.Inspector Dim outApp As Outlook.Application
     Dim myItem As Outlook.MailItem
     Dim myRecip As Outlook.Recipient
     
     Set myinspector = outApp.ActiveInspector
     Set myItem = myinspector.CurrentItem
     Set myRecip = myItem.Recipients
        MsgBox (myRecip)
     myItem.Close olSave
    Debug is Set myinspector line

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    You have not set outapp yet?��
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    haha durrr silly billy me thanks wgm

  9. #9
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Still getting Run time error 91 object variable or with block variable not set!!!


    Click image for larger version. 

Name:	Capture3.JPG 
Views:	14 
Size:	30.5 KB 
ID:	45980

  10. #10
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    Is there a "current" item (you remembered to open an email)?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Dave,
    This might help you with checking if you have an item open:
    https://stackoverflow.com/questions/...ull-in-outlook
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-04-2017, 08:06 AM
  2. Replies: 1
    Last Post: 11-07-2016, 11:18 AM
  3. Email report to value (email address) in a field
    By JackieEVSC in forum Programming
    Replies: 7
    Last Post: 08-28-2015, 11:18 AM
  4. Replies: 1
    Last Post: 05-01-2014, 11:37 AM
  5. Replies: 1
    Last Post: 07-16-2013, 12:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums