Discussione:
Importazione email in Excel
(troppo vecchio per rispondere)
SergioBS
2006-02-21 11:05:27 UTC
Permalink
Salve a tutti!

di nuovo qui a "scroccare".. :-)

devo importare il testo di circa 2000 email da OE in excel, per poi estrarre
dei dati..

c'è qualche modo per automatizzare l'operazione?

grazie

Sergio
Norman Jones
2006-02-21 11:21:28 UTC
Permalink
Post by SergioBS
Salve a tutti!
di nuovo qui a "scroccare".. :-)
devo importare il testo di circa 2000 email da OE in excel, per poi
estrarre dei dati..
c'è qualche modo per automatizzare l'operazione?
grazie
Sergio
'------------------------------

Ciao Sergio,

Purtroppo, il VBA non è disponibile con OE.

Se avessi anche Outlook, potresti esportare gli email da OE a Outlook e,
quindi, da Outlook ad Excel.


---
Regards,
Norman
SergioBS
2006-02-21 11:31:39 UTC
Permalink
Post by Norman Jones
Ciao Sergio,
Purtroppo, il VBA non è disponibile con OE.
Se avessi anche Outlook, potresti esportare gli email da OE a Outlook e,
quindi, da Outlook ad Excel.
---
Regards,
Norman
Grazie Norman
beh.. outlook non l'ho installato ma ci vuole un attimo.. ci provo.. grazie

Sergio
Norman Jones
2006-02-21 11:42:08 UTC
Permalink
Ciao Sergio,
Post by SergioBS
beh.. outlook non l'ho installato ma ci vuole un attimo.. ci provo.. grazie
Aggiungerei che Outlook sarebbe il programma più adatto per estrarre i dati
dagli email e l'uso di Excel non dovrebbe essere necessario.


---
Regards,
Norman
SergioBS
2006-02-21 21:39:48 UTC
Permalink
Post by Norman Jones
Ciao Sergio,
Post by SergioBS
beh.. outlook non l'ho installato ma ci vuole un attimo.. ci provo.. grazie
Aggiungerei che Outlook sarebbe il programma più adatto per estrarre i
dati dagli email e l'uso di Excel non dovrebbe essere necessario.
Grazie Norman..

in effetti devo estrarre la data/ora contenuta nel testo delle emails e con
queste creare alcuni grafici...
pertanto pensavo di utilizzare Excel

Grazie

Sergio
Norman Jones
2006-02-22 02:26:31 UTC
Permalink
Ciao Sergio,
Post by SergioBS
in effetti devo estrarre la data/ora contenuta nel testo delle emails e
con queste creare alcuni grafici...
pertanto pensavo di utilizzare Excel
Per creare un nuovo foglio nel workbook attivo ed estrarre l'oggetto / data
/ mittente da tutti i email nell cartella di Outlook "Pippo", prova:

'=============>>
Public Sub Tester001()
Dim myOlapp As Object
Dim myNamespace As Object
Dim myFolder As Object
Dim myNewFolder As Object
Dim myItem As Object
Dim SH As Worksheet
Dim i As Long
Const miaCartella As String = "Pippo" '<<==== CAMBIA

Set myOlapp = CreateObject("Outlook.Application")
Set myNamespace = myOlapp.GetNamespace("MAPI")
Set myFolder = _
myNamespace.GetDefaultFolder(6) '(olFolderInbox)= 6
Set myNewFolder = myFolder.Folders(miaCartella)

On Error Resume Next
Application.DisplayAlerts = False
Sheets("Email").Delete
Application.DisplayAlerts = True
On Error GoTo XIT

Set SH = ActiveWorkbook.Sheets.Add
SH.Name = "Email"

With SH
i = 1
.Range("A1:C1").Value = _
Array("Data", "Mittente", "Oggetto")
For Each myItem In myNewFolder.Items
i = i + 1
.Cells(i, 1).Value = myItem.ReceivedTime
.Cells(i, 2).Value = myItem.SenderName
.Cells(i, 3).Value = myItem.Subject
Next myItem
.UsedRange.Columns.AutoFit
End With

XIT:
Set myOlapp = Nothing
Set myNamespace = Nothing
Set myFolder = Nothing
Set myNewFolder = Nothing
Set myItem = Nothing
End Sub
'<<=============

Sostituisci "Pippo" col nome della cartella di Outlook che contiene i email
importati da OE.


---
Regards,
Norman
Norman Jones
2006-02-22 03:19:45 UTC
Permalink
Ciao Sergio,

Preferisco la versione seguente:

'=============>>
Public Sub Tester001A()
Dim myOlapp As Object
Dim myNamespace As Object
Dim myFolder As Object
Dim myNewFolder As Object
Dim myItem As Object
Dim SH As Worksheet
Dim i As Long
Const FoglioNome As String = "Email" '<<==== CAMBIA
Const miaCartella As String = "Pippo" '<<==== CAMBIA

Set myOlapp = CreateObject("Outlook.Application")
Set myNamespace = myOlapp.GetNamespace("MAPI")
Set myFolder = _
myNamespace.GetDefaultFolder(6) '(olFolderInbox= 6)
Set myNewFolder = myFolder.Folders(miaCartella)

On Error Resume Next
With Application
.ScreenUpdating = False
.DisplayAlerts = False
Sheets(FoglioNome).Delete
.DisplayAlerts = True
End With
On Error GoTo XIT

Set SH = ActiveWorkbook.Sheets.Add
SH.Name = FoglioNome

i = 1
SH.Range("A1:C1").Value = _
Array("Data", "Mittente", "Oggetto")
For Each myItem In myNewFolder.Items
With myItem
i = i + 1
SH.Range("A" & i & ":C" & i).Value = _
Array(.ReceivedTime, .SenderName, .Subject)
End With
Next myItem
SH.UsedRange.Columns.AutoFit

XIT:
Set myOlapp = Nothing
Set myNamespace = Nothing
Set myFolder = Nothing
Set myNewFolder = Nothing
Set myItem = Nothing

Application.ScreenUpdating = True

End Sub
'<<=============


---
Regards,
Norman
SergioBS
2006-02-22 17:50:30 UTC
Permalink
Post by Norman Jones
Ciao Sergio,
......
Post by Norman Jones
---
Regards,
Norman
Ciao Norman

Grazie veramente.. ma non ce n'era bisogno.. anche se mi sarà d'aiuto per
capire alcune funzioni di excel.

grazie ancora

Sergio

Tiziano Marmiroli
2006-02-21 12:06:28 UTC
Permalink
Post by SergioBS
devo importare il testo di circa 2000 email da OE in excel, per poi estrarre
dei dati..
c'è qualche modo per automatizzare l'operazione?
Io per prima cosa procederei a estrarre le email in file di testo usando
DBXtract.
--
Tiziano Marmiroli
Microsoft MVP - Office System
SergioBS
2006-02-21 21:41:01 UTC
Permalink
Post by Tiziano Marmiroli
Io per prima cosa procederei a estrarre le email in file di testo usando
DBXtract.
--
Tiziano Marmiroli
Microsoft MVP - Office System
Grazie Tiziano.. ho già fatto con la soluzione di Norman..
comunque vedo anche questo programma... magari la prossima...

Grazie

Sergio
Loading...