With Access 2003(and 2007), I send data to an excel file. The excel file does some calcs and sends results back to Access. In order to get excel to export the results, the excel file must be opened and closed after receiving data from Access. My code works fine in A 2003 and 2007, but the excel file won't open-close with Access 2016. Te user has to manually open and close the excel file.
Here is the the code for open-close
Dim xl As Excel.Application, WB As Excel.Workbook
Set xl = CreateObject("Excel.Application")
Set WB = xl.Workbooks.Open(CurrentProject.Path & "" & .ExcelFile)
WB.close True
xl.Quit
Note ".excelFile" is defined in a WITH statement that refers to the excel file name posted on a form.
Any help much appreciated.
Here is the the code for open-close
Dim xl As Excel.Application, WB As Excel.Workbook
Set xl = CreateObject("Excel.Application")
Set WB = xl.Workbooks.Open(CurrentProject.Path & "" & .ExcelFile)
WB.close True
xl.Quit
Note ".excelFile" is defined in a WITH statement that refers to the excel file name posted on a form.
Any help much appreciated.