vodkasoda
05-26-2009, 03:02 AM
I am reading an E:Mail with an attachment of .KIK (it's basically a text file) and will be saving it, replacing the existing file of the same name.
However, I'd like to add some validation to make sure that the file I am receiving is the correct one, and this is done by checking a line within the file that starts "SessionNo=".
The controlling loop is as follows :
For EMailNo = NoOfEMails To 1 Step -1
Set EMail = SubFolder1.Items(EMailNo)
KIKcount = 0
TXTcount = 0
MySkip = False
For Each Atmt In EMail.Attachments
I read the original file as follows :
MyFileNum = FreeFile()
Open KAfullpath For Input As #MyFileNum
Do While Not EOF(MyFileNum)
Input #MyFileNum, MyKIKdata
If Left(MyKIKdata, 10) = "SessionNo=" Then
MyKIKold = Right(MyKIKdata, (Len(MyKIKdata) - 10))
Exit Do
End If
Loop
Close #MyFileNum
and then I try to read the new file as follows :
MyFileNum = FreeFile()
Open Atmt For Input As #MyFileNum
Do While Not EOF(MyFileNum)
Input #MyFileNum, MyKIKdata
If Left(MyKIKdata, 10) = "SessionNo=" Then
MyKIKnew = Right(MyKIKdata, (Len(MyKIKdata) - 10))
Exit Do
End If
Loop
Close #MyFileNum
However, the line ... Open Atmt For Input As #MyFileNum ... gives me an error message of Run Time Error '53': File Not Found ...
I guess that I should be using some other pointer other than Atmt, but what ?!?! Can I do what I want or will I have to save the attachment and access it that way ?
However, I'd like to add some validation to make sure that the file I am receiving is the correct one, and this is done by checking a line within the file that starts "SessionNo=".
The controlling loop is as follows :
For EMailNo = NoOfEMails To 1 Step -1
Set EMail = SubFolder1.Items(EMailNo)
KIKcount = 0
TXTcount = 0
MySkip = False
For Each Atmt In EMail.Attachments
I read the original file as follows :
MyFileNum = FreeFile()
Open KAfullpath For Input As #MyFileNum
Do While Not EOF(MyFileNum)
Input #MyFileNum, MyKIKdata
If Left(MyKIKdata, 10) = "SessionNo=" Then
MyKIKold = Right(MyKIKdata, (Len(MyKIKdata) - 10))
Exit Do
End If
Loop
Close #MyFileNum
and then I try to read the new file as follows :
MyFileNum = FreeFile()
Open Atmt For Input As #MyFileNum
Do While Not EOF(MyFileNum)
Input #MyFileNum, MyKIKdata
If Left(MyKIKdata, 10) = "SessionNo=" Then
MyKIKnew = Right(MyKIKdata, (Len(MyKIKdata) - 10))
Exit Do
End If
Loop
Close #MyFileNum
However, the line ... Open Atmt For Input As #MyFileNum ... gives me an error message of Run Time Error '53': File Not Found ...
I guess that I should be using some other pointer other than Atmt, but what ?!?! Can I do what I want or will I have to save the attachment and access it that way ?