Hi I have a database that's been working fine in Access 2013 but since the upgrade to Access 2016 I am getting an error in the VBA code that exports to excel.
The error is:
Unexpected error occurred: Type mismatch - Number: 13
Below is a snippet of the VBA code, I trapped the error to the specific line noted:
Sub MonthlyReport(xlWs As Excel.Worksheet, xlRng As Excel.Range)
Dim db As DAO.Database
Dim iRow As Integer
Set db = Access.CurrentDb()
iRow = 1
Set xlRng = xlWs.Cells(iRow, 1) '**THIS LINE CAUSES THE ERROR
With xlRng
.Value = "Supplier"
.Font.Bold = True
.Font.Color = vbBlack
.Font.Size = 10
.Font.Underline = True
End With
Can anybody explain why this is happening.
Thanks
The error is:
Unexpected error occurred: Type mismatch - Number: 13
Below is a snippet of the VBA code, I trapped the error to the specific line noted:
Sub MonthlyReport(xlWs As Excel.Worksheet, xlRng As Excel.Range)
Dim db As DAO.Database
Dim iRow As Integer
Set db = Access.CurrentDb()
iRow = 1
Set xlRng = xlWs.Cells(iRow, 1) '**THIS LINE CAUSES THE ERROR
With xlRng
.Value = "Supplier"
.Font.Bold = True
.Font.Color = vbBlack
.Font.Size = 10
.Font.Underline = True
End With
Can anybody explain why this is happening.
Thanks