Moderatori: Anthony47, Flash30005
UE = Worksheets("Scheda").Range("A" & Rows.Count).End(xlUp).Row
For IE = 2 To UE
...
...
BDT = Range("d" & IE).Value
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "Firma"
Nominat = Sheets("Scheda").Range("b1").Value
OutFile = Range("e" & IE).Value
EmailAddr = Range("a" & IE).Value
EmailAddr2 = Range("b" & IE).Value
Subj = Range("c" & IE).Value
...
...
Sub Invioemail()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim EmailAddr2 As String
Dim Subj As String
Dim BodyText As String
UE = Worksheets("Scheda").Range("A" & Rows.Count).End(xlUp).Row
For IE = 2 To UE
' (a)
Set OutApp = CreateObject("Outlook.Application")
''compilazione di un testo standard di accompagnamento
BDT = Range("d" & IE).Value
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "Firma"
'' (b)
Nominat = Sheets("Scheda").Range("b1").Value
OutFile = Range("e" & IE).Value
EmailAddr = Range("a" & IE).Value
EmailAddr2 = Range("b" & IE).Value
Subj = Range("c" & IE).Value
'
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = EmailAddr
.CC = EmailAddr2
.BCC = ""
.Subject = Subj
.Attachments.Add OutFile
.Body = BDT
.Display 'or use .send
'.SendKeys("%(i)")
End With
' (c)
Set OutMail = Nothing
'
' (d)
Set OutApp = Nothing
Application.Wait (Now + TimeValue("0:00:04"))
Application.SendKeys "%i"
Application.Wait (Now + TimeValue("0:00:04"))
Next IE
End Sub
Sub Invioemail()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim EmailAddr2 As String
Dim Subj As String
Dim BodyText As String
UE = Worksheets("Scheda").Range("A" & Rows.Count).End(xlUp).Row
' (a)
Set OutApp = CreateObject("Outlook.Application")
For IE = 2 To UE '<<<< spostare qui dopo aver settato OutApp
''compilazione di un testo standard di accompagnamento
BDT = Range("d" & IE).Value
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "Firma"
'' (b)
Nominat = Sheets("Scheda").Range("b1").Value
OutFile = Range("e" & IE).Value
EmailAddr = Range("a" & IE).Value
EmailAddr2 = Range("b" & IE).Value
Subj = Range("c" & IE).Value
'
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = EmailAddr
.CC = EmailAddr2
.BCC = ""
.Subject = Subj
.Attachments.Add OutFile
.Body = BDT
.Display 'or use .send
'.SendKeys("%(i)")
End With
Application.Wait (Now + TimeValue("0:00:04")) '<<< spostare qui
Application.SendKeys "%i" '<<< spostare qui
Application.Wait (Now + TimeValue("0:00:04")) '<<< spostare qui
' (c)
Set OutMail = Nothing
Next IE '<<< spostare qui
'
' (d)
Set OutApp = Nothing
End Sub
Sub Invioemail()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim EmailAddr2 As String
Dim Subj As String
Dim BodyText As String
UE = Worksheets("Scheda").Range("A" & Rows.Count).End(xlUp).Row
' (a)
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0) '<<<<<< spsotare qui
For IE = 2 To UE
''compilazione di un testo standard di accompagnamento
BDT = Range("d" & IE).Value
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "Firma"
'' (b)
Nominat = Sheets("Scheda").Range("b1").Value
OutFile = Range("e" & IE).Value
EmailAddr = Range("a" & IE).Value
EmailAddr2 = Range("b" & IE).Value
Subj = Range("c" & IE).Value
With OutMail
.To = EmailAddr
.CC = EmailAddr2
.BCC = ""
.Subject = Subj
.Attachments.Add OutFile
.Body = BDT
.Display 'or use .send
'.SendKeys("%(i)")
End With
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "%i"
Application.Wait (Now + TimeValue("0:00:01"))
Next IE '<<< spostare qui
' (c)
Set OutMail = Nothing '
' (d)
Set OutApp = Nothing
End Sub
Sub Invioemail()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim EmailAddr2 As String
Dim Subj As String
Dim BodyText As String
UE = Worksheets("Scheda").Range("A" & Rows.Count).End(xlUp).Row
' (a)
Set OutApp = CreateObject("Outlook.Application")
For IE = 2 To UE
Set OutMail = OutApp.CreateItem(0) '<<<<<< spsotare qui
''compilazione di un testo standard di accompagnamento
BDT = Range("d" & IE).Value
BDT = BDT & vbCrLf & "Cordiali saluti" & vbCrLf
BDT = BDT & "Firma"
'' (b)
Nominat = Sheets("Scheda").Range("b1").Value
OutFile = Range("e" & IE).Value
EmailAddr = Range("a" & IE).Value
EmailAddr2 = Range("b" & IE).Value
Subj = Range("c" & IE).Value
With OutMail
.To = EmailAddr
.CC = EmailAddr2
.BCC = ""
.Subject = Subj
.Attachments.Add OutFile
.Body = BDT
.Display 'or use .send
'.SendKeys("%(i)")
End With
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "%i"
Application.Wait (Now + TimeValue("0:00:01"))
' (c)
Set OutMail = Nothing '
Next IE '<<< spostare qui
' (d)
Set OutApp = Nothing
End Sub
Sub ApriDoc()
Dim applicWD As Object, WordDoc As Object
Set applicWD = CreateObject("Word.Application")
applicWD.Visible = True
Set WordDoc = applicWD.Documents.Open(Filename:="C:\Ciao.doc")
End Sub
WordDoc.Close
applicWD.Quit
Set WordDoc = Nothing
Set applicWD = Nothing
End Sub
' Precedenti istruzioni
Set WordDoc = applicWD.Documents.Open(Filename:="C:\Ciao.doc")
'AGGIUNTE:
applicWD.Selection.WholeStory
applicWD.Selection.Copy
Range("A30").Select
ActiveSheet.Paste
Application.CutCopyMode = False
WordDoc.Close 'CHIUSURA DOC e WORD
applicWD.Quit
Set WordDoc = Nothing
Set applicWD = Nothing
End Sub
Torna a Applicazioni Office Windows
Macro modifica date scelta periodo Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 11 |
Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Visitano il forum: Nessuno e 18 ospiti