I have an excel program which writes data to an Access database. In this database, I have a macro which, when run, copies the data onto another excel file. I want to edit the original excel program so that, after it writes the data to the Access database, it will automatically run the macro. Right now, I have it set so that it writes the data to the database, then opens the database, runs the macro and then closes the database - this seems somewhat ineffecient. Here is the macro in the access database:
Sub copy()
Dim strTable As String
Dim strWorksheetPath As String
strWorksheetPath = "FilePath" & "test.xlsx"
strTable = "test"
DoCmd.OutputTo acOutputTable, strTable, acFormatXLSX, strWorksheetPath
End Sub
The relevant code in the program simply opens the database, calls the macro and closes it. If there is a way around this, without opening the database at all it'd be great. Thanks.
i.e. just to make it clear, I'm looking for a way to mimic the above code in excel, so that I don't need to open the access database at all i.e. someway to transfer data from access, to an excel workbook, without using access VBA.