Question
April 23, 2007 at 06:59 PM
bobbyhoangvu

Using VBScript to send printout to printer

by bobbyhoangvu . Updated 19 years, 6 months ago

I have the a printer that connect to one of the computer in the network, and I have the other computer running the Proficy Ifix (SCADA). The SCADA machine have build-in Scheduler, and the script below works if the scheduler running in the Forground and will not work if the scheduler running in the Background. Please help

Thanks!

Private Sub testing_report_schdl_OnTimeOut(ByVal lTimerId As Long)
Dim objExcel As Object
Dim myFileName As String
Dim strAppPath As String
Dim myDate As String
Dim myCalDate As String

myDate = FormatDateTime(Date, vbShortDate)
myFileName = “\test.xls”
strAppPath = “c:\FILTER_TURB_REPORTS”
Set objExcel = CreateObject(“EXCEL.APPLICATION”)
objExcel.Visible = False

With objExcel
.Workbooks.Open strAppPath & myFileName
.ActiveSheet.Range(“G5”).Value = myDate
myCalDate = Format(myDate, “mmddyy”)
End With
objExcel.ActiveWorkbook.PrintOut
objExcel.ActiveWorkbook.SaveAs Filename:=strAppPath & “\” & myCalDate & “turb” & “.rpt”
objExcel.Quit
End Sub

This discussion is locked

All Comments