Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-04-2020, 03:02 PM
pushpi004 pushpi004 is offline Runtime error "Remote Call Procedure Failed" Windows 10 Runtime error "Remote Call Procedure Failed" Office 2016
Novice
Runtime error "Remote Call Procedure Failed"
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default Runtime error "Remote Call Procedure Failed"

Hi everyone

I have been getting a a lot of help on this forum for my ongoing small project. Specifically, Paul aka macropad has helped me a lot. This issue actually has come pertaining to one of his code.

I have been dealing with an issue lately. I have written a macro in MS word and exported it with relevant referenced Excel files to another system with different configuration.The details are as follows:-

Current system: Windows 10 OS, MS Office 365

New system: Windows 7 OS, MS Office 2007

Upon running the code on the new system after importing it, the runtime error "remote procedure call failed "comes on the line

Set xlWkBk = xlApp.Workbooks.Open(FileName:=StrWkBkNm, ReadOnly:=True, AddToMru:=False)


I have already defined xlApp, xlwkBk as object and StrWkBkNm as location for Excel file. xlApp has also been set with Excel application object.

The code runs perfectly on my current system.
I have tried all sorts of variables for open method but it doesn't work. On giving the direct path of the database, it gives error sometimes as


"Runtime error object required" or sometimes it gives error "open method of workbooks failed" .

I have even changed the database file compatible to MS Excel 2007. But that doesn't work either.

I am struggling with this since couple of days. Can't get through. Please help if you can..
Regards
Reply With Quote
  #2  
Old 03-04-2020, 04:44 PM
macropod's Avatar
macropod macropod is offline Runtime error "Remote Call Procedure Failed" Windows 7 64bit Runtime error "Remote Call Procedure Failed" Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You haven't provided anywhere near enough detail or code relevant to solving the problem. For example:
• Are you using early binding, or late binding?
• If early binding, have you set a reference to Excel on the Office 2007 system?
• Are the file paths exactly the same on both systems?
• Does whatever workbook is named via StrWkBkNm exist in the same location on both systems?
In the other thread where you initially asked this, I did say you needed to provide all the relevant code...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-04-2020, 08:49 PM
pushpi004 pushpi004 is offline Runtime error "Remote Call Procedure Failed" Windows 10 Runtime error "Remote Call Procedure Failed" Office 2016
Novice
Runtime error "Remote Call Procedure Failed"
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default Remote Call procedure failed

Hi Paul. i ll share the entire code with requisite details below.

Code:
Application.ScreenUpdating = False

Dim xlApp As Object, xlWkBk As Object, StrWkBkNm As String, StrWkSht As String
Dim iDataRow As Long, i As Long

Dim xlFList As String, xlRList As String
StrWkBkNm = "C:\abvnsoftware\database\abvndatabase.xlsx"
StrWkSht = "abvnlistwithspaceshyphenontop"

 'code to create F/R list of two columns

  Set xlWkBk = .Workbooks.Open(FileName:=StrWkBkNm, ReadOnly:=True, AddToMru:=False)
  If xlWkBk Is Nothing Then
    MsgBox "Cannot open:" & vbCr & StrWkBkNm, vbExclamation
    .Quit: Set xlApp = Nothing: Exit Sub
  End If
  ' Process the workbook.
  With xlWkBk
     'Ensure the worksheet exists
    If SheetExists(xlWkBk, StrWkSht) = True Then
      With .WorkSheets(StrWkSht)
        ' Find the last-used row in column A.
        iDataRow = .Cells(.Rows.Count, 1).End(-4162).Row ' -4162 = xlUp
        ' Capture the F/R data from the last three rows of the database.
        For i = (iDataRow - 2) To iDataRow
         If Trim(.Range("A" & i)) <> vbNullString Then
            xlFList = xlFList & "|" & Trim(.Range("A" & i))
            xlRList = xlRList & "|" & Trim(.Range("B" & i))
         End If
        Next
      End With
    Else
      MsgBox "Cannot find the designated worksheet: " & StrWkSht, vbExclamation
      Exit Sub
    End If
  .Close False
  End With
End With

' Release Excel object memory
Set xlWkBk = Nothing: Set xlApp = Nothing
'Exit if there are no data
If xlFList = "" Then Exit Sub

I have kept path same on both the systems and workbook exists on same location on both the system.

Last edited by macropod; 03-04-2020 at 08:51 PM. Reason: Added code tags
Reply With Quote
  #4  
Old 03-04-2020, 08:57 PM
macropod's Avatar
macropod macropod is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 7 64bit Runtime error &quot;Remote Call Procedure Failed&quot; Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code you've posted is missing the code that tests for the workbook's existence and, moreover, the code to create an Excel session. See: https://www.msofficeforums.com/34254-post4.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-04-2020, 10:30 PM
pushpi004 pushpi004 is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 10 Runtime error &quot;Remote Call Procedure Failed&quot; Office 2016
Novice
Runtime error &quot;Remote Call Procedure Failed&quot;
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default Remote Call procedure failed

Hi Paul,

Apologies. I mistakenly posted erroneous code. The code with the errors as described earlier is below



Code:
Application.ScreenUpdating = False

Dim xlApp As Object, xlWkBk As Object, StrWkBkNm As String, StrWkSht As String
Dim iDataRow As Long, i As Long
'
Dim xlFList As String, xlRList As String
StrWkBkNm = "C:\abvnsoftware\database\abvndatabase.xlsx"
StrWkSht = "abvnlistwithspaceshyphenontop"

 
If Dir(StrWkBkNm) = "" Then
  MsgBox "Cannot find the designated workbook: " & StrWkBkNm, vbExclamation
  Exit Sub
End If
On Error Resume Next
'Start Excel
Set xlApp = CreateObject("Excel.Application")
If xlApp Is Nothing Then
  MsgBox "Can't start Excel.", vbExclamation
  Exit Sub
End If
On Error GoTo 0


'code to process excel rows & columns


With xlApp
  'Hide our Excel session
  .Visible = False
  
  ' The file is available, so open it.
  Set xlWkBk = .Workbooks.Open(FileName:=StrWkBkNm, ReadOnly:=True, AddToMru:=False)
  If xlWkBk Is Nothing Then
    MsgBox "Cannot open:" & vbCr & StrWkBkNm, vbExclamation
    .Quit: Set xlApp = Nothing: Exit Sub
  End If
  ' Process the workbook.
  With xlWkBk
     'Ensure the worksheet exists
    If SheetExists(xlWkBk, StrWkSht) = True Then
      With .WorkSheets(StrWkSht)
        ' Find the last-used row in column A.
        iDataRow = .Cells(.Rows.Count, 1).End(-4162).Row ' -4162 = xlUp
        ' Capture the F/R data from the last three rows of the database.
        For i = (iDataRow - 2) To iDataRow
         If Trim(.Range("A" & i)) <> vbNullString Then
            xlFList = xlFList & "|" & Trim(.Range("A" & i))
            xlRList = xlRList & "|" & Trim(.Range("B" & i))
         End If
        Next
      End With
    Else
      MsgBox "Cannot find the designated worksheet: " & StrWkSht, vbExclamation
      Exit Sub
    End If
  .Close False
  End With
End With

' Release Excel object memory
Set xlWkBk = Nothing: Set xlApp = Nothing
'Exit if there are no data
If xlFList = "" Then Exit Sub




The errors and problems described are as in previous posts of this thread.

Also, when I exported the code with database to windows 10 is with Ms office 365 on another system, the code worked just fine. I don't know if the problem lies with Windows 7 OS or MS office 2007 or both.

Regards.
Reply With Quote
  #6  
Old 03-04-2020, 10:44 PM
macropod's Avatar
macropod macropod is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 7 64bit Runtime error &quot;Remote Call Procedure Failed&quot; Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You should close all instances of Excel, then check Task Manager to ensure you don't still have any orphaned Excel sessions running in the background. If you've messed up your code development, it's quite possible such an instance is keeping the workbook open.

Until you have the code running correctly, it's advisable to use:
.Visible = True
instead of:
.Visible = False
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 03-05-2020, 01:42 AM
pushpi004 pushpi004 is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 10 Runtime error &quot;Remote Call Procedure Failed&quot; Office 2016
Novice
Runtime error &quot;Remote Call Procedure Failed&quot;
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
You should close all instances of Excel, then check Task Manager to ensure you don't still have any orphaned Excel sessions running in the background. If you've messed up your code development, it's quite possible such an instance is keeping the workbook open.

Until you have the code running correctly, it's advisable to use:
.Visible = True
instead of:
.Visible = False
Sure Paul, I ll implement these things and see if the code runs.

Thanks
Reply With Quote
  #8  
Old 03-12-2020, 11:31 PM
pushpi004 pushpi004 is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 10 Runtime error &quot;Remote Call Procedure Failed&quot; Office 2016
Novice
Runtime error &quot;Remote Call Procedure Failed&quot;
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default Remote Call Procedure failed error

Quote:
Originally Posted by macropod View Post
You should close all instances of Excel, then check Task Manager to ensure you don't still have any orphaned Excel sessions running in the background. If you've messed up your code development, it's quite possible such an instance is keeping the workbook open.

Until you have the code running correctly, it's advisable to use:
.Visible = True
instead of:
.Visible = False
Hi Paul, as suggested by you, I have made necessary amendments. the code works fine in MS Office 2007 only if I set the xlApp object as visible, i.e. .Visible=True. When I change it to False, the error "Remote Call Procedure Failed" comes. Can you throw some light on it and how can I avoid it?

thanks
Regards
Reply With Quote
  #9  
Old 03-13-2020, 12:05 AM
macropod's Avatar
macropod macropod is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 7 64bit Runtime error &quot;Remote Call Procedure Failed&quot; Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The code you've posted is also missing the 'SheetExists' sub. Have you included that in your code module? Also, is any code line highlighted when the 'Remote Call Procedure Failed' error occurs?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #10  
Old 03-13-2020, 01:37 AM
pushpi004 pushpi004 is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 10 Runtime error &quot;Remote Call Procedure Failed&quot; Office 2016
Novice
Runtime error &quot;Remote Call Procedure Failed&quot;
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
The code you've posted is also missing the 'SheetExists' sub. Have you included that in your code module? Also, is any code line highlighted when the 'Remote Call Procedure Failed' error occurs?
Hi Paul,
Yes,sheetexist procedure is present in my code.

And the error comes on the line,

Set xlWkBk = .Workbooks.Open(FileName:=StrWkBkNm, ReadOnly:=True, AddToMru:=False)
Reply With Quote
  #11  
Old 03-13-2020, 01:45 AM
macropod's Avatar
macropod macropod is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 7 64bit Runtime error &quot;Remote Call Procedure Failed&quot; Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try changing that line to:
Set xlWkBk = .Workbooks.Open(StrWkBkNm, False, True)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 03-13-2020, 01:55 AM
pushpi004 pushpi004 is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 10 Runtime error &quot;Remote Call Procedure Failed&quot; Office 2016
Novice
Runtime error &quot;Remote Call Procedure Failed&quot;
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Try changing that line to:
Set xlWkBk = .Workbooks.Open(StrWkBkNm, False, True)
I have tried that already..doesn't work..the only way the code works is when I keep the Excel session visible, i.e. .visible=true
Reply With Quote
  #13  
Old 03-13-2020, 02:08 AM
macropod's Avatar
macropod macropod is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 7 64bit Runtime error &quot;Remote Call Procedure Failed&quot; Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

In that case, you may have a faulty Office installation. Try repairing it
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 03-13-2020, 02:28 AM
pushpi004 pushpi004 is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 10 Runtime error &quot;Remote Call Procedure Failed&quot; Office 2016
Novice
Runtime error &quot;Remote Call Procedure Failed&quot;
 
Join Date: Feb 2020
Posts: 21
pushpi004 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
In that case, you may have a faulty Office installation. Try repairing it
Alright Paul.. I ll reinstall office then.
Reply With Quote
  #15  
Old 03-13-2020, 02:38 AM
macropod's Avatar
macropod macropod is offline Runtime error &quot;Remote Call Procedure Failed&quot; Windows 7 64bit Runtime error &quot;Remote Call Procedure Failed&quot; Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try repairing it first...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Floating" Text (Don't know what else to call it) shawn.low@cox.net Word 0 05-31-2019 09:59 AM
Runtime error &quot;Remote Call Procedure Failed&quot; How to call up "Recovered Files" on demand slavrenz Office 7 10-16-2015 05:57 PM
Error: "Changes made were lost...reconnect with server", when switching "from" field randhurrle Outlook 2 02-25-2015 06:51 PM
Runtime error &quot;Remote Call Procedure Failed&quot; Execution error 2147023170 - Failure call of distant procedure - POWERPOINT 2013 fidecourt PowerPoint 2 02-26-2013 10:25 AM
Microsoft Office 2010 programs display error message "Application has failed to start SamSR Office 1 02-15-2011 07:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft