![]() |
#3
|
|||
|
|||
![]()
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 |
|
![]() |
||||
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 |
![]() |
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 |
![]() |
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 |