In case it wasn't clear from my earlier reply or Moke's comment, then your code should be something like this:
Code:
Private Sub Form_Load()
Dim strCFRFilePath As String
Dim strCFRTableName As String
Dim strCFRRange As String
Dim strRCCFilePath As String
Dim strRCCTableName As String
Dim strRCCRange As String
Dim strWSFilePath As String
Dim strWSTableName As String
Dim strWSRange As String
On Error GoTo ErrorHandler
'Link CFR Table if not already linked
If DCount("*", "MSysObjects", "Name = 'LinkedCFR' And Type = 6") = 0 Then
strCFRFilePath = "D:\Kevin Bolen\AVAILCFRList.xlsx" ' Change to your Excel file path
strCFRTableName = "LinkedCFR" ' Name for your linked Access table
strCFRRange = "A3:AZ" ' Adjust 'IV' to the last possible column containing data This links from A3 to the last used row in column IV
DoCmd.TransferSpreadsheet _
TransferType:=acLink, _
SpreadsheetType:=acSpreadsheetTypeExcel12, _
TableName:=strCFRTableName, _
FileName:=strCFRFilePath, _
HasFieldNames:=True, _
Range:=strCFRRange
End If
'Link RCC Table if not already linked
If DCount("*", "MSysObjects", "Name = 'LinkedRCC' And Type = 6") = 0 Then
strRCCFilePath = "D:\Kevin Bolen\RCCList.xlsx" ' Change to your Excel file path
strRCCTableName = "LinkedRCC" ' Name for your linked Access table
strRCCRange = "A3:AZ" ' Adjust 'IV' to the last possible column containing data This links from A3 to the last used row in column IV
DoCmd.TransferSpreadsheet _
TransferType:=acLink, _
SpreadsheetType:=acSpreadsheetTypeExcel12, _
TableName:=strRCCTableName, _
FileName:=strRCCFilePath, _
HasFieldNames:=True, _
Range:=strRCCRange
End If
'Link Work Spec Table if not already linked
If DCount("*", "MSysObjects", "Name = 'LinkedWorkSpec' And Type = 6") = 0 Then
strWSFilePath = "D:\Kevin Bolen\InProcessWSList.xlsx" ' Change to your Excel file path
strWSTableName = "LinkedWorkSpec" ' Name for your linked Access table
strWSRange = "A3:AZ" ' Adjust 'IV' to the last possible column containing data This links from A3 to the last used row in column IV
DoCmd.TransferSpreadsheet _
TransferType:=acLink, _
SpreadsheetType:=acSpreadsheetTypeExcel12, _
TableName:=strWSTableName, _
FileName:=strWSFilePath, _
HasFieldNames:=True, _
Range:=strWSRange
End If
MsgBox "Excel file9S0 linked successfully!", vbInformation
Exit Sub
ErrorHandler:
MsgBox "Error linking Excel file: " & Err.Description, vbCritical
End Sub