Title: Re: Exporting group email list
On 2/11/06 01:59, "Richard Shane, Ph.D." <[EMAIL PROTECTED]> wrote:


2. Export group list to Excel, with names in one column and emails in second column. I don’t know how to do that. Could any of you tell me how? I believe this option would be preferable to #1.

Thank you.

Richard


-- Export Group to Excel v1.0
-- export group entries from a selected Address Book Group to an excel spreadsheet
-- an applescript by Barry Wainwright <mailto:[EMAIL PROTECTED]>
-- This script released under a Creative Commons Attribution, NonCommercial, ShareAlike 2.0 England & Wales License.
-- see <http://creativecommons.org/licenses/by-nc-sa/2.0/uk/> for full details

tell application "Microsoft Entourage"
    set theBookRef to address book 1
    try
       set theNames to name of every group of theBookRef
   on error errMsg number errNum
       display dialog "No Groups Available for this Address Book" buttons {"Abort"} default button 1 giving up after 10
        return
   end try
   if (count theNames) > 1 then
       set theGroupName to item 1 of (get choose from list theNames ¬
            with title ¬
            "Group Selection" with prompt ¬
            "Please choose the group to export" OK button name ¬
            "Select" multiple selections allowed false ¬
            without empty selection allowed)
        set theGroup to item 1 of (get every group of theBookRef whose name is theGroupName)
    else
       set theGroup to group 1 of theBookRef
   end if
   set theEntries to group entries of theGroup
   set resultList to {}
    repeat with anEntry in theEntries
       copy {display name of content of anEntry, address of content of anEntry} to end of resultList
   end repeat
   set entrycount to count theEntries
end tell

tell application "Microsoft Excel"
    activate
   make new workbook
   set the view of window 1 to normal view
   set the display page breaks of the active sheet to false
   set name of active sheet to name of theGroup
   set theRows to "1:" & entrycount
   set theRange to intersect range1 (range theRows of active sheet) range2 (range "a:b" of active sheet)
    set value of theRange to resultList
   autofit theRange
end tell


--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Check out the Entourage User's WebLog for hints, tips and troubleshooting
<http://homepage.mac.com/barryw/weblog/weblog.html>

Reply via email to