[英]AppleScript for Extracting Email MS Outlook 2016 and saving it to Excel
需要幫助弄清楚如何從 MS Outlook 上的電子郵件中提取內容,並將其保存在 MS Excel 中。 我在下面嘗試過,但我一直在弄清楚如何選擇要從中提取的收件箱的特定電子郵件文件夾。
希望有人能幫忙。
tell application "Microsoft Excel"
set LinkRemoval to make new workbook
set theSheet to active sheet of LinkRemoval
set formula of range "D1" of theSheet to "Message"
set formula of range "C1" of theSheet to "Subject"
set formula of range "B1" of theSheet to "From"
set formula of range "A1" of theSheet to "Date"
end tell
tell application "Microsoft Outlook"
activate
set myAccount to exchange account 2
set theMessages to messages of inbox
set theRow to 2
repeat with aMessage in theMessages
my SetDate(date received of aMessage, theRow, theSheet)
my SetFrom(sender of aMessage, theRow, theSheet)
my SetSubject(subject of aMessage, theRow, theSheet)
my SetMessage(content of aMessage, theRow, theSheet)
set theRow to theRow + 1
end repeat
end tell
on SetDate(theDate, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "A" & theRow
set formula of rangetheRange of theSheet to theDate
end tell
end SetDate
on SetFrom(theSender, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "B" & theRow
set formula of rangetheRange of theSheet to theSender
end tell
end SetFrom
on SetSubject(theSubject, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "C" & theRow
set formula of rangetheRange of theSheet to theSubject
end tell
end SetSubject
on SetMessage(theMessage, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "D" & theRow
set formula of rangetheRange of theSheet to theMessage
end tell
end SetMessage
試試這個設置 theAccount 為第一個用戶名為“xxxxxxxx”的交易所賬戶
set topFolder to mail folder "Inbox" of theAccount
set subFolder to mail folder "xxxxx" of topFolder
set theMessages to messages of subFolder whose time received > xxxxx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.