【问题标题】:Excel vba code to loop through gmail emails in gmail inboxExcel vba 代码循环浏览 gmail 收件箱中的 gmail 电子邮件
【发布时间】:2016-05-04 14:00:23
【问题描述】:

有没有人有 excel vba 代码可以复制和粘贴以循环浏览 gmail 收件箱中的 gmail 电子邮件?

虽然有很多关于:

1) 使用 excel vba 发送 gmail;

2) 在 Outlook 中使用 excel vba 循环浏览电子邮件;和

3) 使用其他编程语言在 gmail 收件箱中循环浏览 gmail 电子邮件;

我在 gmail 收件箱中找不到任何可以循环浏览 gmail 电子邮件的内容。

我知道我实际上要求的是成品。这并不是说我希望任何人都会为我编写代码,但我希望有人可能已经拥有它。

在我尝试调整与上述 1)、2) 和 3) 相关的代码之后,我很清楚我只需要继续发布这个问题。 (谁知道呢,它也可以帮助很多其他人。)

【问题讨论】:

  • 这个问题可能比 SO 更适合 SuperUser.com。正如您所说,您正在要求某人拥有一些代码。您还有三个问题 - 1 是可能的,Google 有很多结果,因为 2 可能是可能的,只需在 Outlook 中使用 VBA(为什么要通过 Excel?),3 可能非常棘手,因为 gmail 收件箱是基于网络的。另外,您尝试了什么代码?请发布您所做的事情,因为 SO 不是“我的代码”或“给我代码”类型的网站。见how to ask

标签: excel vba gmail inbox


【解决方案1】:

您只需要使用文件夹的名称,检查以下内容

Sub SetFlagIcon()
    Dim mpfInbox As Outlook.Folder
    Dim obj As Outlook.MailItem
    Dim i As Integer
    Set mpfInbox = Application.GetNamespace("MAPI").Folders("john.smith@gmail.com").Folders("[Gmail]").Folders("Sent Mail")
    ' Loop all items in the Inbox\Test Folder
    For i = 1 To mpfInbox.Items.Count
        If mpfInbox.Items(i).Class = olMail Then
            Set obj = mpfInbox.Items.Item(i)
            For Each Recipient In obj.Recipients
                If Recipient.Address = "myfriend@hotmail.com" Then
                    'Set the yellow flag icon
                    obj.FlagIcon = olYellowFlagIcon
                    obj.Save
                End If
            Next Recipient
        End If
    Next
End Sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-29
    • 1970-01-01
    • 2011-10-11
    • 2015-10-21
    • 1970-01-01
    • 2017-05-15
    • 2019-10-24
    相关资源
    最近更新 更多