‘Called from NewAccessContactAndID and
‘ImportOutlookContacts
On Error GoTo ErrorHandler
Set fso = CreateObject(“Scripting.FileSystemObject”)
For Each att In con.Attachments
Extract the file name from the Attachment FileName property.
strFile = att.FileName
strDocsPath = GetOutputDocsPath
strFileAndPath = strDocsPath & strFile
Debug.Print “File and path: “ & strFileAndPath
On Error Resume Next
Check whether this file already exists in the folder, and save it to the folder if not
Set fil = fso.GetFile(strFileAndPath)
If fil Is Nothing Then
Save this attachment to a file in the Output Docs folder.
att.SaveAsFile strFileAndPath
End If
On Error GoTo ErrorHandler
Load this attachment to the Attachments field of the target table.
With rstTargetAttachments
.AddNew
.Fields(“FileData”).LoadFromFile _
(strFileAndPath)
.Update
End With
Kill strFileAndPath
Next att
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End Sub
Synchronizing Access and Outlook Contacts 11