我希望能夠通過將其放在腳本上來發送附件文件。如何從拖放中獲取文件路徑和擴展名? BVS
我發現這個發送的文件(我的作品):
Set fso=CreateObject("Scripting.FileSystemObject")
strSMTP="smtp.gmail.com"
strSubject="[email protected]"
strSubject2="Attachment file"
strBody="-"
strAttach="FILEPATH"
If fso.FileExists(strAttach) then
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "[email protected]"
.CC = ""
.BCC = ""
.From = "[email protected]"
.Subject = strAttach
.TextBody = strBody
.AddAttachment strAttach
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Else
MsgBox "The specified attachment does not exist"
End if
我需要的是這個劇本的修改,讓我改變了6號線strAttach="FILEPATH"
與路徑即時消息文件的擴展名,然後執行「發送郵件腳本」。
發現這兩個與我的問題有關的鏈接,但我不知道如何使用它們,希望這些鏈接也能幫助你。 How to get the fully qualified path for a file in VBScript? http://vba-tutorial.com/parsing-a-file-string-into-path-filename-and-extension/
第一個只是顯示的文件路徑和新的窗口擴展,但我需要的是六號線覆蓋。 有人可以幫我嗎?即時通訊不是程序員,只是希望能夠將文件發送到我自己的郵件,因爲我需要以後在另一臺計算機上打印它們。
對不起,我的英語。我不是以英語爲母語的人。提前致謝!
非常感謝你,它的工作。我也會檢查那篇文章。祝你今天愉快。 –