Consulting

Results 1 to 10 of 10

Thread: Automation Error: Call was rejected by callee

  1. #1

    Automation Error: Call was rejected by callee

    Hi guys,

    I've written a macro in outlook that will extract the data from email body and copy it across excel spreadsheet. It's giving me below error:
    run-time error '-214748111 (80010001)':
    automation error
    Call was rejected by callee.

    Please see below the code:
    Public Sub Extract()    
    On Error Resume Next
    Set myOlApp = Outlook.Application
    Set mynamespace = myOlApp.GetNamespace("mapi")
    Dim strRowData As String
    Dim strDelimiter As String
    Dim myDestFolder As Folder
    Dim olMailbox As Folder
    Dim ShareInbox As Folder
    Dim SubFolder As Folder
    Dim InputFolder As String
    Dim OutputFolder As String
    Dim ProdMail As String
    Dim oXLApp As Object, oXLwb As Object, oXLws As Object
    Dim lRow As Long
    On Error Resume Next
    Set oXLApp = GetObject(, "Excel.Application")
    '~~> If not found then create new instance
    If Err.Number <> 0 Then
        Set oXLApp = CreateObject("Excel.Application")
    End If
    Err.Clear
    On Error GoTo 0
    '~~> Open the relevant file
    Set oXLwb = oXLApp.Workbooks.Open("X:\Test1.xlsx")
    'Extract Mailbox and subfolder details from a sheet named as "Folder Details"
    Set oXLws = oXLwb.Sheets("Folder Details")
    Any help will be much appreciated.

    Thanks

  2. #2
    Any idea how this issue can be resolved? Thanks

  3. #3
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    Hi Derek_123,

    On which line do you get the error?
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  4. #4
    VBAX Regular
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    93
    Location
    Quote Originally Posted by Derek_123 View Post
    Any idea how this issue can be resolved? Thanks
    Wow, waited all of 20 mins?
    Apologies for misreading the time on my phone.

    As mentioned, have you walked through your code with F8 and breakpoints?
    I do not even see where you are touching the email body?
    Last edited by Gasman; 03-19-2024 at 08:45 AM.

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    @Gasman, its a bit longer than 20 mins.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  6. #6
    VBAX Regular
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    93
    Location
    Quote Originally Posted by Aussiebear View Post
    @Gasman, its a bit longer than 20 mins.
    Oops, my apologies. :-(

    The other questions still stand though?

    This is the last line that I see in the code window

    Set oXLws = oXLwb.Sheets("Folder Details")

  7. #7
    Hi guys, I'm getting the error at below line:
    Set oXLwb = oXLApp.Workbooks.Open("X:\Test1.xlsx")
    Any help will be much appreciated.

  8. #8
    VBAX Regular
    Joined
    Nov 2020
    Location
    Swansea,South Wales,UK
    Posts
    93
    Location
    Have you checked you actually have an excel object?, as you have On Error Resume Next

  9. #9
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    is that a valid path to the document?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  10. #10
    Sorry It didn't recognize the path. After changing the folder path it worked. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •