Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Buongiorno a tutti.
Volevo chiedere a voi esperti se c'è la possibilità di migliorare la velocità ( o del tutto) queste routines che ho creato per quanto oggetto della mia domanda iniziale.
Public Sub SendWorkSheetToPDF()
'Update 20131209
Dim wb As Workbook
Dim xIndex
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Sheets("Foglio2").Select
Application.ScreenUpdating = False
Set wb = Application.ActiveWorkbook
FileName = wb.FullName
xIndex = VBA.InStrRev(FileName, ".")
If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.to = ActiveSheet.Range("S2") & "@libero.it"
.CC = ""
.BCC = ""
.Subject = "Comunicazioni ore tagliate nel mese indicato"
.Body = "Gentile collega,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" _
& "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww." _
& vbCrLf & "Cordiali saluti."
.Attachments.Add FileName
.Send
End With
Kill FileName
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Application.ScreenUpdating = True
End Sub
Sub SpecialLoop()
Dim LastRow As Long
Application.ScreenUpdating = False
With ActiveSheet
LastRow = .Cells(.Rows.Count, "F").End(xlUp).Row
End With
Dim cl As Range, rng As Range
Dim i As Long
Set rng = Range("F15:F" & LastRow)
For Each cl In rng.SpecialCells(xlCellTypeVisible)
Sheets("Foglio2").Range("F2").Value = cl.Value 'Debug.Print cl
'MsgBox cl
Call SendWorkSheetToPDF
Application.StatusBar = "Sto inviando la Mail al seguente Militare:" & Sheets("Foglio2").Range("D2") & " " & Sheets("Foglio2").Range("E2")
Next cl
MsgBox "OK, Ho Tterminato. ", vbInformation
Application.ScreenUpdating = True
End Sub
Ciao, Nicola.