Open an outlook email by Subject on MS Access linked table with VBA

Status
Not open for further replies.

Juliano

Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
Hi everyone
I linked my Inbox folder to MS access table. It means that every time I open my access table, it is updated as per current emails in my inbox - It is already an built in feature on MS Access.

I would like to know on how from my MS Access, using the Subject field in my linked table I open the same message straight in Outlook email by VBA.

Thanks in advance
 

Juliano

Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
When using the built in option to link my access table to outlook folder, it doesn't show any ID field for email. So manually there is no way to get this field from Outlook that's why my only option was the Subject field.
Actually the record exists on Outlook due its a linked table to Outlook data.
I just don't know how to proceed to make this magic. I mean, this automation by VBA I need assistance from experts.
 

Juliano

Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
Is there a way we can import all outlook table fields so we can get the proper email ID avoiding duplication?
I really don't know how to proceed.
 

Juliano

Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
Scratching the helper, I could develop the code below.
Now my problem is the EntryID field that I don't have on my Access table because when using the assistant, the build in feature don't retrieve this field.
My problem now is how to import/link this field

Code:
Sub openOutlookEmailByAccess()
    Dim OutLookApp As New Outlook.Application
    Dim OutLookNameSpace As Outlook.NameSpace
    Dim OutLookMail As Outlook.MailItem
    Set OutLookNameSpace = OutLookApp.GetNamespace("MAPI")
    OutLookNameSpace.Logon
    Set OutLookMail = OutLookNameSpace.GetItemFromID("00000000B92893D4C199E74592434EEA5D4818860700B38917A16466634586AD214BF5FA94F600A17CBD800D0000B38917A16466634586AD214BF5FA94F600A17CBDBAC70000")
    OutLookMail.Display
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
As long as you have received dates, you should be able to get unique messages using Find or Restrict.
 

Juliano

Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
Well, I'm trying to use your suggestion as per code below. But is saying that a variable was not set. Err 91. Why is not working?

Code:
Sub openOutlookEmailByAccess()
    Dim OutLookApp As New Outlook.Application
    Dim OutLookNameSpace As Outlook.NameSpace
    Dim OutLookMail As Outlook.MailItem
    Dim OutLookItems As Outlook.Items
    Dim OutLookRestItems As Outlook.Items
    Dim strFilter As String
   
    Dim OutLookInboxFolder As Outlook.MAPIFolder
    Dim OutLookSrcFolder As Outlook.MAPIFolder
    Dim strSrcSubject As String
    Dim strSrcReceived As String
   
    Set OutLookNameSpace = OutLookApp.GetNamespace("MAPI")
    Set OutLookInboxFolder = OutLookNameSpace.GetDefaultFolder(olFolderInbox)
   
    Set OutLookSrcFolder = OutLookInboxFolder.Folders("@04-COMPLETED")
   
    OutLookNameSpace.Logon
    strSrcSubject = "[Subject]= 'Testing Tips'"
    strSrcReceived = "[Received] ='" & Format("03/11/2017 08:06:19", "ddddd h:mm:ss AMPM") & "'"
   
    strFilter = strSrcSubject & " And " & strSrcReceived
   
    Set OutLookItems = OutLookSrcFolder.Items
    OutLookRestItems = OutLookItems.Restrict(strFilter)
   
End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
E Unable to open Outlook 2010 after adding new email account Using Outlook 4
Z Outlook 2007, clicking email addresses fails to open Contact Using Outlook 0
D Outlook VBA to open Excel attachment and send recipient's email address to a workbook cell? Using Outlook 4
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
D Outlook 2010: Change the font for the area at the top of an open email. Using Outlook 1
D Outlook 2013 Doesn't Send email from Web Page Unless Outlook Is Open Using Outlook 2
mrje1 mailto links in browsers don't open up outlook email Using Outlook 2
M Outlook 2007 "cannot open your default email folders.microsoft exchange is not available" on XP is n Using Outlook 1
G I can't open a URL link in from my email- Using Outlook 2007-Vista- AVG anti-virus Using Outlook 1
P cannot open default email folders errors in c:\users\officemax\appdata\local\microsoft\outlook\outlook.pst Using Outlook 1
E I am trying to extract the email adress's i have in outlook. These are not saved 'contacts' these are ones from auto fill. When i open up an email, an Using Outlook 1
L MSOffice 2007 Outlook functions normal, but crashes on specific email's when a reading pane is open. Using Outlook 7
M Can't open a link within email using outlook 2003. My laptop is windows office 2007. Using Outlook 1
2 email icons in outlook changing to open Using Outlook 2
M Distribution lists not working, outlook will not open properly and email stuck in outbox. Using Outlook 3
P Can't open attachments in body of email in Outlook 2010. Using Outlook 4
B Tried to set outlook and now all i get is box telling me I cannot open default email folder Using Outlook 2
K Outlook 2007 When I attempt to open a new email, it won't open and says 'not responding' Using Outlook 5
G Prevent my AT&T email from being imported into Outlook 2003 when I open outlook. Using Outlook 1
C Email attachments will not open in outlook nor will they open if I save and try to open. They are sh Using Outlook 1
G Can't open email on Microsoft Outlook 2007 that contain java script Using Outlook 1
J When I send a pdf file to outlook it goes to the junk email and then I cannot open PDF because it converts to a word document. I have acrobat on my co Using Outlook 3
A outlook restart whenever second email is open. Using Outlook 2
P Cannot email an open Excel or Word document using Outlook 2003 Using Outlook 1
H outlook email marked as read event did not open Using Outlook 5
M Trying to send 68MB file to a printers - send/rec says complete but email still in outbox and says cannot open as outlook has begun transmitting the m Using Outlook 4
G Calender doesn´t open. A restart is necessary to use other functionality (email, tasks) of Outlook 2007 Using Outlook 1
B OUTLOOK WONT OPEN CANNOT CONNECT TO DEFAULT EMAIL STORE CLOSED Using Outlook 1
E Double clicking on from email address does no longer open corresponding contact in Outlook 2007 Using Outlook 7
A Cannot start Microsoft Office Outlook. Cannot open the Outlook Window. - had computer and email address for years without a problem- this just occured Using Outlook 2
B Can't open links properly within an email in Outlook 2003 Using Outlook 6
J Unable to open links in Outlook 7 email messages. Using Outlook 7
J Macro to open email (like double click) in Outlook Outlook VBA and Custom Forms 4
A How to open a specific link automatically with outlook 2016 Outlook VBA and Custom Forms 5
H Upon opening Outlook, make my popmail inbox open instead of outlook.com inbox Using Outlook 1
sahameed82 SharePoint calendar directly open in Outlook Using Outlook 0
C Outlook 2016/2019 hangs after being open for an extended period Using Outlook 4
J How to open OST file in Outlook 2019 & 2016 Using Outlook 1
C Can't Open Outlook 365 Using Outlook 0
M outlook won't open! Using Outlook 1
A How to open a specific link automatically with outlook Outlook VBA and Custom Forms 13
S Outlook 2010 Cannot Open Attachments Using Outlook 14
N open the hyperlink in Outlook directly instead of browser Using Outlook 1
S Outlook does not open the .pst file created by the Outlook Using Outlook 5
A open Outlook with multiple windows. Using Outlook 0
G Can't open .pst. Message could not access default folder (Outlook 2010 (.pst). Before that was backi Using Outlook 0
I Outlook 2010, 2013 will not open .msg or .eml files Using Outlook.com accounts in Outlook 1
Diane Poremsky Outlook VBA: Work with Open Item or Selected Item New Slipstick.com Articles 0
O Windows 10 x64 Outlook 2013 - URL does not open (anymore) Using Outlook 3
Diane Poremsky Outlook 2013: Control Panel Mail Won't Open New Slipstick.com Articles 0
Similar threads


















































Top