Freshman
Registered User.
- Local time
- Today, 08:11
- Joined
- May 21, 2010
- Messages
- 437
Hi all Excel Gurus
I'm using the following VBA code in Access 2003 to "fix" a spreadsheet by deleting the first 3 rows before I can use it in an Access Query.
Is there any reason why the code should not work for other versions of Office.
It works fine on my PC running Access2003 and Win7 plus Office 2013
as well as on a Win10 machine with Acces2003 and Office 2003.
It seems to fail on one of my Clients running Win8 and Access2003 with Office 2013.
I don't know the error since they running a MDE version of my app but all I can see is that the code does not implement since the spreadsheet remains the same (not deleting the top 3 rows).
The Client is far away so I will have to investigate later if I cannot find a solution based on my post.
Thanks
Pierre
I'm using the following VBA code in Access 2003 to "fix" a spreadsheet by deleting the first 3 rows before I can use it in an Access Query.
Is there any reason why the code should not work for other versions of Office.
It works fine on my PC running Access2003 and Win7 plus Office 2013
as well as on a Win10 machine with Acces2003 and Office 2003.
It seems to fail on one of my Clients running Win8 and Access2003 with Office 2013.
I don't know the error since they running a MDE version of my app but all I can see is that the code does not implement since the spreadsheet remains the same (not deleting the top 3 rows).
The Client is far away so I will have to investigate later if I cannot find a solution based on my post.
Thanks
Pierre
Code:
Private Function FixSheetForPastel()
On Error GoTo Err_FixSh
Dim wb As Object
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
''xlApp.Visible = True
Set wb = xlApp.Workbooks.Open("C:\MyPath\MySheet.xls", True, False)
wb.Sheets("Sheet1").Rows(1).Delete
wb.Sheets("Sheet1").Rows(1).Delete
wb.Sheets("Sheet1").Rows(1).Delete
wb.Save
wb.Close
''xlApp.Visible = False
Exit Function
Err_FixSh:
MsgBox "Error fixing Excel sheet", vbInformation, "Notice"
End Function