I have been asked to use a query in Access and return the results into ThisWorkbook.FullName where the code resides. I am not permitted to use the Get External Data option in Excel due to business reasons. I have the references set for Microsoft Access. I get an Error 3275, and highlights the DoCmd Line.
The code I am trying to use is as follows:
The code I am trying to use is as follows:
Code:
Sub openaccess2()
Dim appAcc As New Access.Application
Const path As String = "L:\PassToExcel.mdb"
With appAcc
.opencurrentdatabase path
.DoCmd.SetWarnings False
.DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryData", ThisWorkbook.FullName, True
.DoCmd.SetWarnings True
.Visible = True
End With
appAcc.Quit
appAcc Nothing
End Sub