title: Access macro to read emails from MS Outlook
body: <p>I have a macro in Access that connects to the running instance of MS Outlook.</p>
  
  <p>The macro had been working, until last week when I started receiving the error: <strong>Activex component can't create object</strong> whenever I ran the macro.</p>
  
  <p>Here's a piece of the code and where it's currently failing:</p>
  
  <pre><code>Function GatherDailyStats()
  Dim oOlAp As Object, oOlns As Object, oOlInb As Object
  Dim oOlItm As Object
  'Dim FileName As
  Dim i, j As Integer
  Dim strDir1 As String
  Dim strDir2 As String
  '~~&gt; Get Outlook instance
  Set oOlAp = GetObject(, "Outlook.Application") '--**THIS IS WHERE IT FAILS**
  Set oOlns = oOlAp.GetNamespace("MAPI")
  Set oOlInb = oOlns.GetDefaultFolder(olFolderInbox).Folders.Item("Daily Stats")
  
  '~~&gt; Check if there are any actual unread emails
  If oOlInb.Items.Restrict("[UnRead] = True").Count = 0 Then
      MsgBox "NO Unread Email In Daily Stats folder"
      Exit Function
  End If
  </code></pre>
  
  <p>Nothing has changed in the code since I created it and tested it thoroughly.</p>
  
  <hr>
  
  <p>Update: I just tested the same application on a different computer and it worked perfectly there. </p>