我有以下代码,用于转发电子邮件,并包含我自己的消息。
Private Sub Items_ItemAdd(ByVal item As Object)
Dim filenum As Integer
Dim current_number As String
filenum = FreeFile()
Open "G:\Infrastructure Services\Engineering Services\Hazard Report Number.txt" For Input As #filenum
While Not EOF(filenum)
Line Input #filenum, current_number
Wend
If item.Class = olMail Then
If Left$(item.Subject, 29) = "Hazard Identification Report" Then
Dim Msg As Outlook.MailItem
Dim NewForward As Outlook.MailItem
Dim myFolder As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Set Msg = item
Set NewForward = Msg.Forward
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
strSender = ""
strsenderName = Msg.SenderEmailAddress
If strsenderName = "EX" Then
Set objSender = itm.Sender
If Not (objSender Is Nothing) Then
Set objExchUser = Sender.GetExchangeUser()
If Not (objExchUser Is Nothing) Then
strSender = objExchUser.PrimarySmtpAddress
End If
End If
Else
strSender = strsenderName
End If
With NewForward
.Subject = "Hazard report reciept number:"
.To = strSender
.HTMLBody = "TYhank you for your email"
.Send
End With
End If
End If
ExitProc:
Set NewForward = Nothing
Set Msg = Nothing
Set olApp = Nothing
Set olNS = Nothing
End Sub
我已经从我的文本文件中读取了值,没问题。我的问题是如何从文本文件中删除值,并将值 +1 打印回文本文件?
此外,这意味着将消息转发回发件人,包括他们的原始附件和消息(照片和一些 GPS 坐标),但不是出于某种原因,我不明白为什么。
任何机构有什么建议吗?