I am developing an Access 2003 application with Excel.
I create an Access table via a stored procedure and transfer it to an Excel file for user viewing with the following statements.
Do you know how I could send a message box to the user asking if they want to Keep the Excel file or DELETE it ?
The user wants to initially view the Excel file but after they view it, I would like to ask the user the question whether or not they want to "SAVE THE EXCEL FILE OR DELETE THE EXCEL FILE ?
The Excel file is created via the DoCmd.Transferspreadsheet command. I have limited space on a server in which to KEEP the file and therefore I only want the Excel file to remain saved if the user chooses to keep the file.
--------------------------
----
ExportedFile = strAccessPath0 & "AAAACCTS" & "_" & intYearSP & "_" & Format(Now, "mmddhhnnss") & ".XLS"
DoCmd.TransferSpreadsheet acExport, 8, "dbo.tblUDLAAAAccts", ExportedFile, True, ""
footnote = "This file represents AAA Debit Card Account Activity."
If isFileExist(ExportedFile) Then StartDocLexNex ExportedFile, footnote, strScreenType, txtDateFrom1099.Value, txtDateTo1099.Value
--------------------------
----------
----------
----------
------
Private Sub StartDocLexNex(filename, footnote, strScreenType, txtDateFrom, txtDateTo)
Dim xlApp As Object
Dim xlWB As Object
Dim xlWS As Object
Dim intRows As Long
Set xlApp = CreateObject("excel.applic
ation")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Open(filen
ame)
Set xlWS = xlWB.Worksheets(1)
xlWS.Columns.AutoFit
intRows = xlWS.UsedRange.Rows.count
xlWS.Cells(intRows + 5, 1).Value = footnote
xlWS.Cells(intRows + 6, 1).Value = "For the period " & txtDateFrom & " To " & txtDateTo
xlApp.ScreenUpdating = True
End Sub
Start Free Trial