Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default select file fro listbox and send via email

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\SERVI ZIO\" &
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\SERVI ZIO
\" & 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default select file fro listbox and send via email

Please clarify:

1. What excel version and operating system are you using?
2. Where, specifically does the procedure fail?
3. What is the error message?


On Oct 9, 6:21 am, sal21 wrote:
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\SERVI ZIO\" &
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\SERVI ZIO
\" & 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run marco to send a excel file by email(lotus note) Wu Excel Discussion (Misc queries) 1 December 12th 09 05:42 AM
how to send file to email shaz0503 Excel Discussion (Misc queries) 0 June 30th 09 10:43 PM
Send file in an email SAS Excel Programming 2 July 17th 06 05:26 PM
File...Send To...Email Recipient Bill Oertell[_2_] Excel Programming 2 January 1st 04 03:02 AM
Save a file and send as an email - written into macro Louise Semaj Excel Programming 1 October 22nd 03 02:19 AM


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"