The Following function is running without error, but it does not download attachment to local disk.
It shows file can be found in path But there is no file.

I used the following call

GetAttachmentFromTest "QTP9.0_QC Driver_2","test.txt","C:\aa\"



Public Function GetAttachmentServerPath (TestObject, FileName, LongFileName)
Set AttachmentFactory = TestObject.Attachments
Set AttachmentList = AttachmentFactory.NewList("SELECT * FROM CROS_REF")

For Each Attachment in AttachmentList
If StrComp(Attachment.Name(1), FileName, 1) = False Then
LongFileName = Attachment.Name
Pos = Instr(1, Attachment.ServerFileName, Attachment.Name, 1)
GetAttachmentServerPath = Left(Attachment.ServerFileName, Pos - 1)
Exit Function
End If
Next
GetAttachmentServerPath = ""
End Function

Public Function GetAttachmentFromTestObject (TestObject, FileName, OutPath)
MyPath = GetAttachmentServerPath(TestObject, FileName, LongFileName)

If StrComp(MyPath, "") = 0 Then
GetAttachment = ""
Exit Function
End If

If Right(OutPath, 1) <> "\" Then
OutPath = OutPath & "\"
End If

' Load the attachment using the extended storage object
Set ExtendedStorage = TestObject.ExtendedStorage
ExtendedStorage.ServerPath = MyPath
ExtendedStorage.ClientPath = OutPath
ExtendedStorage.Load LongFileName, True

GetAttachmentFromTestObject = OutPath & LongFileName
End Function

' Get an attachment from the current test
Public Function GetAttachment(FileName, OutPath)
Set CurrentTest = TDUtil.CurrentTest

GetAttachment = GetAttachmentFromTestObject(CurrentTest, FileName, OutPath)
End Function

' Get an attachment from another test
Public Function GetAttachmentFromTest(TestName, FileName, OutPath)
Set TDConnection = TDUtil.TDConnection

Set TestList = TDConnection.TestFactory.NewList("SELECT * FROM TEST WHERE TS_NAME = '" & TestName & "'")
GetAttachmentFromTest = GetAttachmentFromTestObject(TestList(1), FileName, OutPath)
End Function