简体   繁体   English

Outlook将附件保存到文件不起作用

[英]Outlook Save attachment to file not working

I've used this VBA code several times before, on the same machine. 我曾在同一台计算机上使用过几次VBA代码。 Now I've set up a new profile on this machine and I'm using the exact same code I have used before, but now it doesn't work. 现在,我在这台机器上设置了一个新的配置文件,并且使用的代码与以前使用的完全相同,但是现在不起作用。

Code below: 代码如下:

Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Whatever folder I need it in"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub

Then I create a rule to run a script, set it up like I set up previously on other account and it turns into (Client Only rule) and when I try to run it it says "Client only rule can only run when Outlook is running", but outlook is running though... 然后,我创建一个运行脚本的规则,像以前在其他帐户上设置的一样进行设置,然后变成(“仅客户端”规则),当我尝试运行它时,它说“仅在Outlook运行时才能运行“仅客户端规则” ”,但前景仍在运行...

I also get this error: 我也收到此错误:

在此处输入图片说明

Anyone has any idea of what's wrong? 任何人都知道怎么了吗?

Typically the C:\\ drive requires admin privileges for writing/creating files. 通常, C:\\驱动器需要管理员权限才能写入/创建文件。 Try to choose another drive or folder for saving attached files. 尝试选择另一个驱动器或文件夹来保存附件。

Ignore my question! 忽略我的问题! Rookie mistake! 菜鸟错误! I'm so sorry for wasting your time fellas. 很抱歉浪费您的时间。

I'm missing a slash on my path file..... 我在路径文件中缺少斜线.....

Thanks for your help anyway people! 无论如何,感谢您的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM