java中上传附件怎么该名称_将附件保存到Outlook中的文件夹并重命名
我正在尝试将Outlook附件保存到文件夹中,并且文件名已经存在,将较新的文件保存在不同的名称下,以便不保存现有文件....也许只是给一个扩展名“v2”甚至“v3”如果“v2”存在 .
我遇到了这个答案,但我发现较新的文件保存在现有文件中
我使用了以下代码;
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim i As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolderpath As String
Dim strDeletedFiles As String
' Get the path to your My Documents folder
strFolderpath = "C:\Users\Owner\my folder is here"
On Error Resume Next
' Instantiate an Outlook Application object.
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects.
Set objSelection = objOL.ActiveExplorer.Selection
' Set the Attachment folder.
strFolderpath = strFolderpath & "\my subfolder is here\"
' Check each selected item for attachments. If attachments exist,
' save them to the strFolderPath folder and strip them from the item.
For Each objMsg In objSelection
' This code only strips attachments from mail items.
' If objMsg.class=olMail Then
' Get the Attachments collection of the item.
Set objAttachments = objMsg.Attachments
lngCount = objAttachments.Count
strDeletedFiles = ""
If lngCount > 0 Then
' We need to use a count down loop for removing items
' from a collection. Otherwise, the loop counter gets
' confused and only every other item is removed.
For i = lngCount To 1 Step -1
' Save attachment before deleting from item.
' Get the file name.
strFile = objAttachments.Item(i).FileName
' Combine with the path to the Temp folder.
strFile = strFolderpath & strFile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strFile
' Delete the attachment.
objAttachments.Item(i).Delete
'write the save as path to a string to add to the message
'check for html and use html tags in link
If objMsg.BodyFormat <> olFormatHTML Then
strDeletedFiles = strDeletedFiles & vbCrLf & ""
Else
strDeletedFiles = strDeletedFiles & "
" & "" & strFile & ""
End If
'Use the MsgBox command to troubleshoot. Remove it from the final code.
'MsgBox strDeletedFiles
Next i
' Adds the filename string to the message body and save it
' Check for HTML body
If objMsg.BodyFormat <> olFormatHTML Then
objMsg.Body = vbCrLf & "The file(s) were saved to " & strDeletedFiles & vbCrLf & objMsg.Body
Else
objMsg.HTMLBody = "
" & "The file(s) were saved to " & strDeletedFiles & "
" & objMsg.HTMLBody
End If
objMsg.Save
End If
Next
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub
我对vba比较新,所以也许解决方案就在那里,但我没有看到它!
java中上传附件怎么该名称_将附件保存到Outlook中的文件夹并重命名相关推荐
- finder刷新文件夹_如何在OS X Finder中自定义文件夹视图
finder刷新文件夹 Any location in OS X has options to change its view. The best part is you can set each l ...
- python复制文件到另一个文件夹并重命名_基于python实现复制文件并重命名
方法: shutil.copy("c://ccc//模板.xlsx","c://ccc//新文件.xlsx") 需求: 已知的Excel模板格式.已知的文件命名 ...
- MinIo 安装及其集成到java中上传下载图片信息
MinIo 安装及其集成到java中上传下载图片信息 win 下安装 下载链接:https://min.io/download#/windows 下载好后cmd打开控制台 输入:minio.exe s ...
- autojs实现的百度云网盘登录上传下载创建文件夹重命名删除文件等功能
说明 本文提供的代码仅供参考.不建议用于生产环境. 可能有些地方在最新版本的Auto.js上面需要做修改,才能运行. Auto.js简介 Auto.js是利用安卓系统的"辅助功能" ...
- java 创建文件夹的方法_java中创建文件夹的方法
java中创建文件夹的方法 发布时间:2020-06-10 11:46:49 来源:亿速云 阅读:461 作者:Leah 这篇文章给大家分享的是java中创建文件夹的方法.小编觉得挺实用的,因此分享给 ...
- 01-Win10家庭版修改C盘下的用户目录中账户文件夹名称(新版家庭版不能改了,新版家庭版此方法无效)
注意:新版家庭版用此方法无法更改.(2019-10-10更新) 新电脑开机进入系统时,当时设置了一个中文名称,导致C:\Users目录下文件夹名称为中文,导致许多软件在安装运行上出现问题. 解决问题的 ...
- java中上传头像前剪切和预览
首先说我是个渣渣,写这个供自己以后回顾及一些比我还新的新手借鉴一下,共同学习.共同进步. 百度了好几天,调了3个星期,每天晚上下班回来打开电脑就是调,头都大了,最后还是不负我努力啊,终于正常了点,不过 ...
- java中上传本地图片
如果你想上传多张图片:http://blog.csdn.net/xuanzhangran/article/details/54929988 如果是上传单张如下: 点击上传图片按钮,上传本地 效果如图: ...
- java中上传视频到FTP,从FTP直接播放
因项目要求,从应用系统中将视频与数据关联后把文件存储至FTP服务器中,应用系统点击详情后可查看关联的视频.(FTP服务与应用服务器为两台服务器). 在需要关联视频的数据后添加操作上传视频操作做按钮 d ...
最新文章
- 【Python】有道翻译的爬虫实现(前篇)
- Call to undefined function mysql_connect()
- Yii 2.0 GII 访问404错误
- Linux内存管理 -- smaps讲解
- 超400万用户的Chrome截图插件下架始末
- Visio 图案填充-设置形状格式
- YUV format online tool
- ad19做直插封装 ipc_共享一下自己的PCB封装库(Altium Designer)
- GHOST XP SP2 遐想网络 纯净驱动版 3.1
- 海康rtsp视频流媒体服务器搭建(去除flash插件):rtsp > nginx-rtmp > http-flv > flv.js
- python判断一个数是否是素数
- 人脸表情识别系统(VGG_16和Xception模型)配置GPU加速,Fer2013数据集和CK+数据集,tensorboard
- JavaScript 进阶 - 第2天
- 【eCPRI】(1)基本概念
- 手机兼容性测试--testin云测流程
- 获取代理IP(proxy_pool)
- Cocos Creator基于热更新的分包方案
- 警猫眼Arduino源码分享,把闲置手机变成安防监控摄像头!
- 四位大小写字母和数字随机验证码
- 有坐标的主买量占比主卖占比判断操盘通达信指标公式源码 附效果图
热门文章
- java 二维数组作为参数传递_java JNI 二维数组作为方法参数传递给本地
- rose顺序图转换为协作图_【S7200指令教程】顺序控制指令SCR SCRT SCRE
- exe解包和重新打包_pyinstaller打包的exe太大?你需要嵌入式python玄学 前提篇
- win7光盘修复计算机在哪,win7如何创建系统还原及系统修复光盘功能应用
- android.mk 优化编译,android下ndk编译c优化
- 七十三、SpringBoot整合Jpa
- spring mvc 渲染html,在Spring MVC中使用Thymeleaf模板渲染Web视图
- windows平台下TensorFlow的各种安装不成功
- web-packwebpack .\src\main.js .\dist\bundle.js 报错
- ICCV 2021 | 重铸Regression荣光!具有残差对数似然估计的人体姿态回归