thread181-510401
I have searched high and low for a solution to this.
I have a macro in Access that will open Excel and a specific excel file. Works OK (See code below)
====================================================
Function OpenExcelFromAccess()
Dim MyXL As Object
Set MyXL = CreateObject("Excel.Application")
With MyXL
.Application.Visible = True
.Workbooks.Open "C:\Users\Barry-DTW7\Desktop\Data Collection\Form 1.xls"
End With
End Function
=========================================================
Once the Excel file is open, I want to close the Access database and the Access Application.
I have tried using the "Quit" command in the Macro but the error code says it's not available; even though I choose it from a drop down menu. I have used the "Close database" command and that works, but leaves the Access Application still open.
I am not real familiar with VB. How would I edit the code above to accomplish this.
I have searched high and low for a solution to this.
I have a macro in Access that will open Excel and a specific excel file. Works OK (See code below)
====================================================
Function OpenExcelFromAccess()
Dim MyXL As Object
Set MyXL = CreateObject("Excel.Application")
With MyXL
.Application.Visible = True
.Workbooks.Open "C:\Users\Barry-DTW7\Desktop\Data Collection\Form 1.xls"
End With
End Function
=========================================================
Once the Excel file is open, I want to close the Access database and the Access Application.
I have tried using the "Quit" command in the Macro but the error code says it's not available; even though I choose it from a drop down menu. I have used the "Close database" command and that works, but leaves the Access Application still open.
I am not real familiar with VB. How would I edit the code above to accomplish this.