Hi
I have recently moved to a new PC (windows 10 home, Excel 2016) from my old PC ( W10 Pro, Excel 2016) and have found that part of one of my Excel workbooks no longer works as expected.
The workbook that includes the following VBA :-
Sub get_mail()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
For Each olMail In Fldr.Items
‘ ** Extract stuff from olMail.Subject and olMail.Body into excel worksheet**
:
:
Next olMail
End Sub
This used to work on my old machine and correctly extracted information from mail items in my current Outlook Inbox. However, on the new machine I get a problem at the "Set Fldr" line. It pops up a small dialogue which asks me to Create New Profile. I didn't used to get this. Why do I need a new profile? Why isn't it picking up my Outlook profile?.... I suspect there is something wrong in my environment, but what am I doing wrong?
Is there anything I can do to better understand what is going on?
Any help gratefully accepted
Thanks
Rob
I have recently moved to a new PC (windows 10 home, Excel 2016) from my old PC ( W10 Pro, Excel 2016) and have found that part of one of my Excel workbooks no longer works as expected.
The workbook that includes the following VBA :-
Sub get_mail()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
For Each olMail In Fldr.Items
‘ ** Extract stuff from olMail.Subject and olMail.Body into excel worksheet**
:
:
Next olMail
End Sub
This used to work on my old machine and correctly extracted information from mail items in my current Outlook Inbox. However, on the new machine I get a problem at the "Set Fldr" line. It pops up a small dialogue which asks me to Create New Profile. I didn't used to get this. Why do I need a new profile? Why isn't it picking up my Outlook profile?.... I suspect there is something wrong in my environment, but what am I doing wrong?
Is there anything I can do to better understand what is going on?
Any help gratefully accepted
Thanks
Rob