Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any way to do this in Outlook 2007?

Status
Not open for further replies.

pst133ox

IS-IT--Management
Aug 24, 2007
27
US
I had an issue yesterday where a user had compiled a list of addresses they wanted to send to someone from various emails.

They were not in their contact list (just entered from emails they had received)

They were trying to cut and paste this list (once complete) from the to: field to the body of the message.

In the TO: field they were displayed like 'Recepient' [Mail@recip .com]; etc.

When Ctrl+c'd and Ctrl+v'd they were displayed as just Recepient.

I realize the []s inidicate the email addresse being displayed next to the display name (recepient)-


Is there a way to do this without adding them to a contact list and attaching their business cards?


 
Wonder if you could copy to a text file then delete all except the email address
Code:
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\Test.txt", ForReading)

strContents = objFile.ReadAll
objFile.Close

Set objRegEx = CreateObject("VBScript.RegExp")

objRegEx.Global = True   
objRegEx.Pattern = "\[.{0,}\]"

Set colMatches = objRegEx.Execute(strContents)  

If colMatches.Count > 0 Then
   For Each strMatch in colMatches   
       strMatches = strMatches & strMatch.Value   
   Next
End If

strMatches = Replace(strMatches, "]", vbCrlf)
strMatches = Replace(strMatches, "[", "")

Set objFile = objFSO.OpenTextFile("C:\Scripts\Test.txt", ForWriting)
objFile.Write strMatches
Wscript.Echo strMatches
 
If you right-click on the Display Name and E-Mail address, in Outlook and select "Outlook Properties" from the drop down menu; in the resulting window you should just be able to copy and paste the actual E-mail address without the attached Display Name.
 
@GrimR
Copying to a text file was the issue. When copied the email addresses would not come with the copied text. It appeared it was just copying what I would consider a pointer for the information in Outlook

@linney
I eventually ended up just doing this to get the e-mail addresses out. I was more interested in whether or not there was some way to make it copy the full range of data available to it rather than just the name that came over in the text file. I was quite surprised there was not a way to do this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top