i use this:
Before
excelWB.Worksheets(SHNAME).PrintOut
i nedd to printpreview the sheet, possible?
Code:
Private Sub Command2_Click()
If Me.ListView1.ListItems.Count >= 1 Then
Screen.MousePointer = vbHourglass
Me.Text1.SetFocus
Me.LAZIONI.Caption = "STAMPA IN CORSO..."
DoEvents
Set excelWB = excelApp.Workbooks.Open(FILENAME:=STRPATH1 & WBNAME)
Set excelWS = excelWB.Worksheets(SHNAME)
FILENAME = Me.LTXT.Caption
FNAME = Left(FILENAME, InStrRev(FILENAME, ".") - 1)
excelWS.RANGE("A2").Value = "CODICE PROGRESSIVO: " & FNAME
excelWS.RANGE("A3").Value = "CLIENTE: " & NOME
excelWS.RANGE("A4").Value = "RICERCA: " & NOME
excelWS.RANGE("E2").Value = "DATA INTERVENTO: " & DATA
excelWS.RANGE("E3").Value = "INDIR: " & INDIRIZZO
excelWS.RANGE("E4").Value = "CITTA': " & COMUNE
excelWS.RANGE("I2").Value = "OPERATORE: " & DATO
excelWS.RANGE("I3").Value = "CAP: " & CAP
excelWS.RANGE("I4").Value = "PROVINCIA: " & "(" & PR & ") - " & PROVINCIA
'FILL SHEET TEMPLATE
'Call FILL_SHEET
'FILL SHEET TEMPLATE
With Printer
.PaperSize = vbPRPSA4
End With
excelWB.Worksheets(SHNAME).PrintOut
excelWB.Close savechanges:=False
Set excelWB = Nothing
Set excelWS = Nothing
excelApp.Quit
Me.LAZIONI.Caption = "TUTTO OK!"
DoEvents
Sleep (1500)
Me.LAZIONI.Caption = ""
Screen.MousePointer = vbDefault
Else
Beep
Me.Text1.SetFocus
Me.LAZIONI.Caption = "SELEZIONARE PRIMA UN FILE!"
DoEvents
Sleep (1500)
Me.LAZIONI.Caption = ""
Me.Text1.SetFocus
End If
End Sub
Before
excelWB.Worksheets(SHNAME).PrintOut
i nedd to printpreview the sheet, possible?