Hello. I'm a beginning/intermediate user, and I've managed to put together some code from what I've found online. I've tried doing this several ways, but it always seems to require that I use "Dim xlApp As Excel.Application". This causes a "User-type not defined" error. I'm trying do do this in my form's click event. I want the button-click to close the spreadsheet (the one created down the code in the same event) ---WITHOUT-- saving before anything else when the button is clicked. It would work if the spreadsheet was just cleared as well. Here is what is currently there:
Code:
Private Sub Transfer_Click()
Dim curPath As String
curPath = CurrentProject.Path & "\OtusBug" & ".xlsx"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.TransferSpreadsheet acExport, 10, "tblOtusTemp", curPath, -1
Application.FollowHyperlink curPath
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from tblOtusTemp"
DoCmd.SetWarnings True
Me.Requery
End Sub