Torna al Thread
Try
ScriviEventLog("Debug", "Creo wapp", EventLogEntryType.Information)
wApp = CreateObject("Word.Application")
ScriviEventLog("Debug", "OK", EventLogEntryType.SuccessAudit)
ScriviEventLog("Debug", "Leggo def printer", EventLogEntryType.Information)
DefaultPrinter = wApp.ActivePrinter
ScriviEventLog("Debug", "OK", EventLogEntryType.Information)
' setto la stampante sulla quale stampare
ScriviEventLog("Debug", "Setto printer " & printer, EventLogEntryType.Information)
wApp.ActivePrinter = Printer
ScriviEventLog("Debug", "OK", EventLogEntryType.SuccessAudit)
'apro il documento
ScriviEventLog("Debug", "Open Doc " & Doc.ToString, EventLogEntryType.Information)
wApp.Documents.Open(Doc.ToString)
ScriviEventLog("Debug", "OK", EventLogEntryType.SuccessAudit)
'stampo su file
ScriviEventLog("Debug", "Stampo", EventLogEntryType.Information)
wApp.PrintOut(, , , gsdir & "temp.gs", , , , , , , True, , Doc.ToString, , , , , , )
ScriviEventLog("Debug", "OK", EventLogEntryType.SuccessAudit)
'ripristino la stampante di default
ScriviEventLog("Debug", "Ripristino printer", EventLogEntryType.SuccessAudit)
wApp.ActivePrinter = DefaultPrinter
ScriviEventLog("Debug", "OK", EventLogEntryType.SuccessAudit)
'Esco da Word
ScriviEventLog("Debug", "wapp quit", EventLogEntryType.Information)
wApp.Quit()
ScriviEventLog("Debug", "OK", EventLogEntryType.SuccessAudit)
wait(3) 'attesa 3 secondi
ScriviEventLog("Debug", "obj delete", EventLogEntryType.SuccessAudit)
wApp = Nothing
DefaultPrinter = Nothing
ScriviEventLog("Debug", "Fine step 1", EventLogEntryType.SuccessAudit)
Catch ex As Exception
ScriviEventLog("Debug", "ERRORE step 1 " & ex.Message, EventLogEntryType.FailureAudit)
End Try