K
Kerstin Schiebel
Hi,
I use sometimes a little script for importing a text file for creating a
distribution list.
The syntax for the text file is email;name
I get a DL where the display name is always the email address. Now
emailaddress = display name
I want to change the script that the name is always imported into the field
"display name".
I would be very lucky, if someone could give me a hint.
Thank you very much.
Kerstin
-----------------------
'Öffnen der Datei
Set f = fs.GetFile(Dateiname)
Set ts = f.OpenAsTextStream(ForReading, TristateFalse)
'The MailItem is required to create the Recipients collection
Set myMailItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myMailItem.Recipients
I = 1
'Lesen der einzelnen Datensätze und hinzufügen der EMail-Adressen
'ASCII-Datei in der Form: emailadresse; Name
While ts.AtEndOfStream <> True
zeile = ts.ReadLine
Pos = InStr(1, zeile, ";")
If Pos > 0 Then
EMailAdr = Mid(zeile, 1, Pos - 1)
myRecipients.Add EMailAdr
Else
MsgBox "Fehler in " & zeile
End If
Wend
'Create the Distribution List item
Set myDistList = myFolder.Items.Add(olDistributionListItem)
myDistList.DLName = InputBox("Bitte geben Sie den Namen der Liste ein: ",
, "???")
myDistList.AddMembers myRecipients
myDistList.Save
---------------------
I use sometimes a little script for importing a text file for creating a
distribution list.
The syntax for the text file is email;name
I get a DL where the display name is always the email address. Now
emailaddress = display name
I want to change the script that the name is always imported into the field
"display name".
I would be very lucky, if someone could give me a hint.
Thank you very much.
Kerstin
-----------------------
'Öffnen der Datei
Set f = fs.GetFile(Dateiname)
Set ts = f.OpenAsTextStream(ForReading, TristateFalse)
'The MailItem is required to create the Recipients collection
Set myMailItem = myOlApp.CreateItem(olMailItem)
Set myRecipients = myMailItem.Recipients
I = 1
'Lesen der einzelnen Datensätze und hinzufügen der EMail-Adressen
'ASCII-Datei in der Form: emailadresse; Name
While ts.AtEndOfStream <> True
zeile = ts.ReadLine
Pos = InStr(1, zeile, ";")
If Pos > 0 Then
EMailAdr = Mid(zeile, 1, Pos - 1)
myRecipients.Add EMailAdr
Else
MsgBox "Fehler in " & zeile
End If
Wend
'Create the Distribution List item
Set myDistList = myFolder.Items.Add(olDistributionListItem)
myDistList.DLName = InputBox("Bitte geben Sie den Namen der Liste ein: ",
, "???")
myDistList.AddMembers myRecipients
myDistList.Save
---------------------