houseofturner
Registered User.
- Local time
- Today, 14:12
- Joined
- Dec 10, 2009
- Messages
- 37
I have an Sage ACT! database which I need to connect to Access 2003 so I can use previously written reports in Access. I cant seem to do this directly but I can create a Excel workbook which use an OLE link to get the data from ACT!, I can then link this to Access using a linked table.
The problem that I have is that I need to refresh the data in the Excel file and then only way this can be done is opening it and closing it again. I am using the code below in Access to do this but it seems to only work once.
I think this is because it does not close the workbook properly as to get it to work a second time I need to go into task manager and kill any Excel processes.
The code I am using is:
Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.displayalerts = False
appexcel.workbooks.Open "T:\database\LiveACTContactData.xls"
appexcel.activeworkbook.refreshall
appexcel.Visible = False
I assume that this is because the Excel workbook is not closing after the process but is hidden but how do I do this?
The problem that I have is that I need to refresh the data in the Excel file and then only way this can be done is opening it and closing it again. I am using the code below in Access to do this but it seems to only work once.
I think this is because it does not close the workbook properly as to get it to work a second time I need to go into task manager and kill any Excel processes.
The code I am using is:
Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.displayalerts = False
appexcel.workbooks.Open "T:\database\LiveACTContactData.xls"
appexcel.activeworkbook.refreshall
appexcel.Visible = False
I assume that this is because the Excel workbook is not closing after the process but is hidden but how do I do this?