Printer.print (get object 464 error)
I don't care how I do the print, although I'm not a big fan of one of the options, reading the file line by line and printing it line by line. The code below gives you an idea of what I have tried. The commented out sections gave an error when I first tested, hence they are commented out. The variable assignments at the top are not the right ones for the commented out code, so although I kept the commented out code to remind me what I have tried, I didn't keep all the supporting code.
Private Sub CommandButtonPrnt_Click() Dim ofso As New FileSystemObject Dim sPath As String Dim Item As Collection Set ofolder = ofso.GetFolder("F:\temp\") 'MsgBox "whatever" + (ofolder.Files.Count) ' Set ofso = ofolder.Files sPath = "\\vmsalesnusetst\taxware\temp\" sFile = "product.txt" Debug.Print ("\\vmsalesnusetst\taxware\temp\product.txt") ' Call Shell("C:\WINNT\NOTEPAD " & sPath & sFile, 1 PrintTXTFile = ("F:\temp\verazip.txt") '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 'Const SW_SHOWNORMAL = 1 'ShellExecute Me.hwnd, "Print", app.path & "temp\verazip.txt", vbNullString, "F:\", SW_SHOWNORMAL Call PrintFile("F:\temp\Product.txt") Call PrintFile("F:\temp\product.txt") Call PrintFile("F:\temp\salestax.txt") 'This prints on the default printer End Sub Private Sub PrintFile(ByVal sFile As String) Dim sText As String, iFile As Byte iFile = FreeFile Open sFile For Input As iFile sText = Input(LOF(iFile), iFile) Close iFile sText = Trim$(sText) Printer.Print sText Printer.EndDoc End Sub