S
sal21
I use this to piece of code to select from listbox2 the name of file
and send it vie email, but not work...
In effect all file are stored in this path:
OLDER_DOC = ("\\GCD01F4500\DATI\PUBBLICA\MODULI_GARANZIE\SERVIZIO\" &
dire & "\" & sotto & "\")
Sub INVIO_MODULI()
Dim FileArr As Variant
Dim olApp As Object
Dim olMsg As Object
Dim F As Variant
Dim FOLDER_DOC As String
FOLDER_DOC = ("\\GCD01F4500\DATI\PUBBLICA\MODULI_GARANZIE\SERVIZIO
\" & dire & "\" & sotto & "\")
Call SELEZIONE_MODULI(FileArr)
If FileArr = Empty Then
MsgBox "NESSUN FILE SELEZIONATO", vbCritical, "INVIO
CANCELLATO"
Exit Sub
End If
Set olApp = CreateObject("Outlook.Application")
Set olMsg = olApp.CreateItem(0)
With olMsg
.Body = "TEST MESSAGGIO"
.Subject = "TEST OGGETTO"
For Each F In FileArr
.Attachments.Add F
Next F
.Display
End With
Set olMsg = Nothing
Set olApp = Nothing
End Sub
Sub SELEZIONE_MODULI(FileArr)
Dim I As Integer
FileArr = ""
For I = 0 To UserForm3.ListBox2.ListCount - 1
If UserForm3.ListBox2.Selected(I) Then
FileArr = UserForm3.ListBox2.List(I)
End If
Next I
End Sub
and send it vie email, but not work...
In effect all file are stored in this path:
OLDER_DOC = ("\\GCD01F4500\DATI\PUBBLICA\MODULI_GARANZIE\SERVIZIO\" &
dire & "\" & sotto & "\")
Sub INVIO_MODULI()
Dim FileArr As Variant
Dim olApp As Object
Dim olMsg As Object
Dim F As Variant
Dim FOLDER_DOC As String
FOLDER_DOC = ("\\GCD01F4500\DATI\PUBBLICA\MODULI_GARANZIE\SERVIZIO
\" & dire & "\" & sotto & "\")
Call SELEZIONE_MODULI(FileArr)
If FileArr = Empty Then
MsgBox "NESSUN FILE SELEZIONATO", vbCritical, "INVIO
CANCELLATO"
Exit Sub
End If
Set olApp = CreateObject("Outlook.Application")
Set olMsg = olApp.CreateItem(0)
With olMsg
.Body = "TEST MESSAGGIO"
.Subject = "TEST OGGETTO"
For Each F In FileArr
.Attachments.Add F
Next F
.Display
End With
Set olMsg = Nothing
Set olApp = Nothing
End Sub
Sub SELEZIONE_MODULI(FileArr)
Dim I As Integer
FileArr = ""
For I = 0 To UserForm3.ListBox2.ListCount - 1
If UserForm3.ListBox2.Selected(I) Then
FileArr = UserForm3.ListBox2.List(I)
End If
Next I
End Sub