I have written a small application to simply open and print an Invoice that is an Excel spreadsheet. I want to never see it happen. I just want to wake up and the invoice be ready. I have successful written a program to accomplish this except that since I have used the Now() function in the spreadsheet the date changes and thus Excel request to know if you want to save changes. I do not. I simply want the program to end without any user interaction. Here is a copy of my code.
Option Explicit
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 6
Const SW_HIDE = 0
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
'Call ShellExecute(Me.hWnd, "print", "TheScarms.xls", "", 0, SW_SHOWNORMAL)
Dim retval As Long
retval = ShellExecute(Me.hwnd, "print", "C:\My Documents\NEO INVOICE.xls", "", "C:\My Documents\", 0)
Unload Me
End Sub
Thanks for looking it over.
Option Explicit
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 6
Const SW_HIDE = 0
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
'Call ShellExecute(Me.hWnd, "print", "TheScarms.xls", "", 0, SW_SHOWNORMAL)
Dim retval As Long
retval = ShellExecute(Me.hwnd, "print", "C:\My Documents\NEO INVOICE.xls", "", "C:\My Documents\", 0)
Unload Me
End Sub
Thanks for looking it over.