
Sub inviomail()
Dim corpo As String, nome As String, promo As String
Dim row_number As Integer, tessera As Integer
'per visualizzare i decimali si deve utilizzare il tipo Double
Dim netto As Single
'riga di partenza della colonna A: primo indirizzo in riga 2
row_number = 2
With Foglio1
Do
DoEvents
corpo = .Range("J2")
nome = .Range("B" & row_number) '& " " & .Range("C" & row_number)
tessera = .Range("C" & row_number)
promo = .Range("D" & row_number)
netto = Format(.Range("E" & row_number), "0.00")
corpo = Replace(corpo, "replace_name_here", nome)
corpo = Replace(corpo, "promo_code_replace", promo)
corpo = Replace(corpo, "netto_replace", netto)
corpo = Replace(corpo, "tessera_replace", tessera)
'MsgBox corpo
Call SendEmail(.Range("A" & row_number), "2° Avviso rimborso", corpo)
row_number = row_number + 1
'l'invio delle mail si ferma quando trova la prima cella vuota lungo la colonna A
Loop Until .Range("A" & row_number) = ""
End With
End Sub
|
Dim sSignature As String, textline As String
Open Environ("appdata") & "MicrosoftSignatures
ometuafirmadefault.txt" For Input As #1
Do Until EOF(1)
Line Input #1, textline
sSignature = sSignature & Chr(13) & textline
Loop
Debug.Print sSignature |
Option Explicit
Sub Lafiiiiiiiiiiiirma()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' ATTENZIONE RICHIEDE L'ATTIVAZIONE DELLA LIBRERIA MICROSOFT SCRIPTING RUNTIME '''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim oFSYS As New FileSystemObject 'leggasi sopra, attiva la libreria
Dim oTxt As TextStream 'Tipo per file di testo
Dim sSignature As String
Set oFSYS = New FileSystemObject
Set oTxt = oFSYS.OpenTextFile(Environ("appdata") & "MicrosoftSignaturesDavide Pietraroia.txt")
With oTxt
While Not .AtEndOfStream
sSignature = sSignature & .ReadLine & Chr(13)
Wend
.Close
sSignature = Trim(Replace(sSignature, " ", ""))
Debug.Print sSignature
End With
Set oTxt = Nothing
Set oFSYS = Nothing
End Sub
|
