Function ReadAllTextFile()
Const ForReading = 1, ForWriting = 2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\Temp\email.txt", ForReading)<<<< change this to c:\users\%Username%\temp\Email.txt
ReadAllTextFile = f.ReadAll
End Function
Public Sub UpdateSubject()
Dim SaveCode As String
Dim KeyWord As String
Dim objItem As MailItem
KeyWord = "ABC"
SaveCode = InputBox("Please enter filecode in the format nnn/nnn", "VisualFiles Auto Save", ReadAllTextFile)
MsgBox SaveCode
Set objItem = GetCurrentItem()
objItem.Subject = "[" + KeyWord + "=" + SaveCode + "] " + objItem.Subject
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function