首页 文章

Outlook从超链接下载文件

提问于
浏览
0

我正在寻找一些帮助来自动执行我每天做几次的任务 .

我收到来自某个地址的电子邮件,我会自动将其(使用规则)排序到专用文件夹中 .

这些电子邮件包含要从网上下载的文档的超链接;但是链接不是作为URL写的,而是有一个链接说“下载所有文档” .

我点击此链接,它会打开URL,这是所有文档的zip文件 . 然后我将此zip文件以某种命名格式保存到某个文件夹中 .

我正在寻求自动化这个过程 . 手动执行它是一项繁琐的任务,因为我收到了很多这样的电子邮件,并且重命名它们需要时间,因为默认名称包含非法字符 .

我以前做过一些编程,但在VBA(Excel)中只有一点编程而从不用于Outlook .

我在论坛中搜索了类似的问题,看来我可以使用URLDownloadToFile函数(例如UrlDownloadToFile in Access 2010 - Sub or Function not Defined);但是我需要将URL传递给该函数,并且我不会在电子邮件正文中包含't know how to get that out of the email since it' .

有人能帮我一下吗?

1 回答

  • 1

    URL位于超链接中 . https://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.hyperlink_members.aspx

    Sub HyperlinkAddress()
    
    Dim msg As Object
    Dim oDoc As Object
    Dim h As Object
    
    Set msg = ActiveInspector.currentItem
    
    If msg.GetInspector.EditorType = olEditorWord Then
    
        Set oDoc = msg.GetInspector.WordEditor
    
        For Each h In oDoc.Hyperlinks
            Debug.Print "Displayed text: " & h.TextToDisplay & vbCr & " - Address: " & h.Address
            'h.Follow
        Next
    
    End If
    
    Set msg = Nothing
    Set oDoc = Nothing
    Set h = Nothing
    
    End Sub
    

相关问题