Advertisement
Advertisement
| 04.21.2008 at 10:16AM PDT, ID: 23340276 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: |
Private Sub FileOutput_Click()
On Error GoTo Err_FileOutput_Click
Dim sDestDir As String
Dim sSourceFile As String
sDestDir = "C:\Foldername\"
sSourceFile = "\\Servername\root\....'Templatelocation'.xls"
stDocName = "Report"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal
'Make dest dir if required
If Dir(sDestDir, vbDirectory) = "" Then
MkDir sDestDir
End If
DoCmd.TransferSpreadsheet acExport, "Report", "\\Servername\root\....'Templatelocation'.xls", True, ""
DoCmd.Close acQuery, "Report"
FileCopy "\\Servername\root\....'Templatelocation'.xls", "C:\Foldername\" & "Report" & Format(Now, "mmmyy") & ".xls"
DoCmd.SetWarnings False
Shell "explorer.exe C:\Foldername\", vbNormalFocus
DoCmd.SetWarnings False
Err_FileOutput_Click:
MsgBox Err.Description
Resume Exit_FileOutput_Click
End Sub
|