score:4

Accepted answer
Private Sub btnExportConsultations_Click()
    Dim curPath As String

    curPath = CurrentProject.Path & "\Consultations - " & _
        Format(Date, "mm-dd-yyyy") & ".xlsx"
    DoCmd.TransferSpreadsheet acExport, 10, "Consultations", curPath, -1
    Application.FollowHyperlink curPath 
End Sub

score:0

Private Sub btnExportConsultations_Click()

    Dim curPath As String
    Dim xlApp As Object

        curPath = CurrentProject.Path & "\Consultations - " & Format(Date,"mm-dd-yyyy")
        DoCmd.TransferSpreadsheet acExport, 10, "Consultations", curPath, -1

        Set xlApp = CreateObject("Excel.Application")
        xlApp.Workbooks.Open(curPath)
        xlApp.Visible = True

End Sub

Related Articles