I am in a pickle at my workplace linking a shared Microsoft Outlook 365 folder to Microsoft Access 365. The company disabled all wizards; therefore I cannot link to the folder using the MS Access interface. It seems I will need to accomplish this programmatically in VBA. The closest I got in searching the internet is the following : https://www.access-programmers.co.uk/forums/threads/linking-an-outlook-folder-with-vba.291562/
However, I cannot seem to make it work as the connection string does not seem right. If anybody has experience with this, please let me know. I really appreciate it. Thank you.
Below is the modified code:
Public Function linkOutLookFolder()
Dim myDb As Database
Dim myTD As TableDef
Dim strConnect As String
Set myDb = CurrentDb
strConnect = "Outlook 9.0;MAPILEVEL=dennis.nerada@comed.com|;PROFILE=Out look;TABLETYPE=0;TABLENAME=Inbox;COLSETVERSION=12. 0;DATABASE=C:\Users\dnerada\AppData\Local\Temp\;TA BLE=Inbox"
Set myTD = myDb.CreateTableDef(“Inbox”)
myTD.Connect = strConnect
'myTD.SourceTableName = “OutLookFolder”
myTD.SourceTableName = “Inbox”
myDb.TableDefs.Append myTD
End Function
I receive the error in the attached file (3125.JPG) when I run the function and it throws the error on the line which contains the following syntax: myDb.TableDefs.Append myTD