Below is a script which works fine, so whats the problem i hear, well we need to pick up a different file location instead of c:\temp\email.txt. We need to point it too c:\users\%Username%\temp\Email.txt.

I have tried various environment scripts for user profiles but when ever i add in the results to the script below i have errors, any chance you can point me in the right direction


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