Applescript:无法将date和消息内容从Outlook复制到Excel

我试图从一个文件夹复制Outlook电子邮件,并将其复制到一个Excel文档。 我现在有拉动主题和发件人,但我有两个主要问题。 一,我不能拉date属性的date。 二,我不能只拉取消息内容,因为它从Outlook消息中提取所有的HTML。 这是我现在的完整代码…

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 theRow to 2 set theMessages to messages of mail folder "Requests" repeat with aMessage in theMessages my SetFrom(sender of aMessage, theRow, theSheet) my SetDate(date 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 range theRange 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 range theRange of theSheet to name of theSender end tell end SetFrom on SetSubject(theSubject, theRow, theSheet) tell application "Microsoft Excel" set theRange to "C" & theRow set formula of range theRange 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 range theRange of theSheet to theMessage end tell end SetMessage 

此外,当代码将邮件内容粘贴到Excel文件时,它不粘贴所有文本,它只粘贴250个字符。

显示消息内容不显示的问题的excel文件

我试了一下,发现如下:

使用time receivedtime received值和plain text content而不是datecontent

 tell application "Microsoft Outlook" activate set theRow to 2 set theMessages to messages of mail folder "Requests" repeat with aMessage in theMessages my SetFrom(sender of aMessage, theRow, theSheet) my SetDate(time received of aMessage, theRow, theSheet) my SetSubject(subject of aMessage, theRow, theSheet) my SetMessage(plain text content of aMessage, theRow, theSheet) set theRow to theRow + 1 end repeat end tell 

关于另一个问题,我成功地使用set value of cell to ...而不是set formula of range to ...

 on SetMessage(theMessage, theRow, theSheet) tell application "Microsoft Excel" set theRange to "D" & theRow set value of cell theRange of theSheet to theMessage end tell end SetMessage 

可见单元格的内容less于整个邮件内容,但是您可以滚动浏览内容并查找整个(纯文本)内容。

玩得开心,迈克尔/汉堡/德国