Results 1 to 6 of 6
  1. #1
    dnerada is offline Novice
    Windows 10 Office 365
    Join Date
    Jun 2022
    Posts
    1

    Linking a shared Microsoft Outlook 365 folder to Microsoft Access 365 programmatically with VBA

    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
    Attached Thumbnails Attached Thumbnails 3125.JPG  

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    So did you try the code posted in this other forum:
    https://www.access-programmers.co.uk...h-vba.291562/?
    Your code looks like it has some funky double-quotes, can you try this (use the # code tags to post code in this forum):
    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=Outlook;TABLETYPE=0;TABLENAME=Inbox;COLSETVERSION=12.0;DATABASE=C:\Users\dnerada\AppData\Local\Temp\;TABLE=Inbox"
    
    
    Set myTD = myDb.CreateTableDef("Inbox")
    myTD.Connect = strConnect
    myTD.SourceTableName = "Inbox"
    myDb.TableDefs.Append myTD
    
    
    End Function
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    First cossposted at https://www.access-programmers.co.uk...th-vba.291562/ as acknowledged by Gicu.
    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

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    @Welshgasman: not sure it would quite qualify as cross-posted as the OP of the other one was NauticalGent. But I agree, would be nice to be aware of it...

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

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Well the O/P posted the same post there and here?
    I would qualify as a crosspost.
    O/P was asked if they had set variables correctly as they appeared to just had copied and pasted, without understanding what was copied.?
    Regardless, I would prefer members are aware of all posts, whichever forum they are on?
    O/P did not respond to the reply to his post in other forum, merely posted same post here.
    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

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    It's a cross post for sure, and it reaches a new level - it's a hijacking cross post.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-14-2021, 10:03 AM
  2. Replies: 4
    Last Post: 02-25-2020, 02:52 AM
  3. Replies: 2
    Last Post: 07-25-2019, 12:33 PM
  4. Replies: 1
    Last Post: 09-13-2011, 01:52 PM
  5. Access link to Microsoft Outlook
    By epallaron in forum Access
    Replies: 0
    Last Post: 09-19-2007, 07:25 AM

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