Hello all,
In Access, I'm trying to transfer a table to a spreadsheet, but I only want to do it if the spreadsheet file is CLOSED. I have tried a few things that I've read online, but with no luck. So I want to run the following code ONLY if the file Metrics Monthly Metrics Report is closed. Here is my code:
I should mention that I want to ensure it's not loaded on anybody's computer. (E:\ is a shared drive)
In Access, I'm trying to transfer a table to a spreadsheet, but I only want to do it if the spreadsheet file is CLOSED. I have tried a few things that I've read online, but with no luck. So I want to run the following code ONLY if the file Metrics Monthly Metrics Report is closed. Here is my code:
Code:
Private Sub cmdCategoryYTD_Click()
'-----------------------------------
'Export Pending to Excel
'-----------------------------------
Dim strLoc As String
Dim strTbl As String
Dim strDest As String
'File Name
strLoc = "E:\MIS\"
strTbl = "tblPending"
strDest = strLoc & "Metrics\Monthly Metrics Report.xls"
'Export to Excel
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, strTbl, strDest, True
End Sub
I should mention that I want to ensure it's not loaded on anybody's computer. (E:\ is a shared drive)
Last edited: