Download an attachment

Public Function AttachmentDownLoad() As Boolean
    
    
'This routine gets a bug attachment and downloads the file
' using the Attachment object.
    On Error GoTo FUNC_ERR
    
    Dim BugFact As BugFactory
    Dim bugObj As Bug
    Dim attachFact As AttachmentFactory
    Dim attachObj As Attachment
    Dim attachList As List
    Dim LoadPath As String
'Get any defect with at least one attachment
    'tdc is the global TDConnection object.
    Set BugFact = tdc.BugFactory
    Set bugObj = BugFact.Item(1)
    Debug.Print bugObj.Summary
    'Amended: The list of flights is given even when past date set as Departing date
' Get an attachment.
    Set attachFact = bugObj.Attachments
    Set attachList = attachFact.NewList("")
    Set attachObj = attachList.Item(1)
    Debug.Print attachObj.FileName
    'C:\DOCUME~1\steves\LOCALS~1\Temp\TD_80\423af35f\Attach\BUG1\BUG_1_err.log
        '
'Put a value in LoadPath to demonstrate that it is not used.
    LoadPath = "c:\temp"
'-----------------------------------------
'Use Attachment.Load to
' download the attachment.
    attachObj.Load True, LoadPath
' Output the actual download location.
    Debug.Print LoadPath
    'C:\DOCUME~1\steves\LOCALS~1\Temp\TD_80\423af35f\Attach\BUG1

    AttachmentDownLoad = SUCCESS
Exit Function
FUNC_ERR:
    AttachmentDownLoad = FAILURE
End Function