Lifeseeker
Registered User.
- Local time
- Yesterday, 19:02
- Joined
- Mar 18, 2011
- Messages
- 273
Hi there,
I have an access application that writes data to Excel 2013. I have tested it on both Access 2010 to Excel 2010, and it worked, but not when I switch to Excel 2013.
Is there a way to have Access 2010 open Excel 2010 instead of 2013?? This is the code in Access 2010
It fails on this line:
Can someone help?
I have an access application that writes data to Excel 2013. I have tested it on both Access 2010 to Excel 2010, and it worked, but not when I switch to Excel 2013.
Is there a way to have Access 2010 open Excel 2010 instead of 2013?? This is the code in Access 2010
Code:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "M:\test\testAutomatic.xlsx", True, False
lastRow = xlApp.activesheet.usedrange.rows.Count
xlApp.worksheets("test").Activate
'delete existing records in Excel
Dim i As Long
Dim j As Long
For i = 13 To lastRow
For j = 1 To 11
xlApp.worksheets("test").cells(i, j).Value = ""
Next j
Next i
It fails on this line:
Code:
xlApp.worksheets("test").cells(i, j).Value = ""
Can someone help?