View Single Post
 
Old 03-04-2020, 08:49 PM
pushpi004 pushpi004 is offline Windows 10 Office 2016
Novice
 
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