A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
My apologies for not getting back to you sooner but I have been away for a few days.
I assuming that if the text boxes are on a Userform then your code is in the Userform code module or if the text boxes are on a worksheet then the code is in the worksheets module. If not one of these then I many need to edit the code for you.
AFAIK you cannot reference a closed workbook with worksheet functions in VBA so the workbook needs to be opened. The code first tests if the workbook is open and if not, then opens it.
When using a worksheet function in VBA, the references are set up as in VBA; not as a reference as used on a worksheet with the function. However, it is possible to insert a worksheet function on the worksheet so it is like as if it was entered directly on the worksheet but the following code does not do that.
Dim wBook As Workbook
Dim wShtTableArray As Worksheet
Dim rngTableArray As Range
On Error Resume Next
'Test if file already open
Set wBook = Workbooks("FileNameSource.xlsb")
On Error GoTo 0
If wBook Is Nothing Then 'If nothing then not open so open the workbook.
Set wBook = Workbooks.Open(Filename:="D:\FolderName\FileName.xlsb")
End If
Set wShtTableArray = wBook.Worksheets("Sheet1")
With wShtTableArray
Set rngTableArray = .Range(.Cells(2, "A"), .Cells(12100, "B"))
End With
Me.TextBox6.Text = Application.WorksheetFunction.VLookup(Me.TextBox5, rngTableArray, 2, False)