‘Called from NewAccessContactAndID and
‘ImportOutlookContactsOn Error GoTo ErrorHandlerSet fso = CreateObject(“Scripting.FileSystemObject”)For Each att In con.AttachmentsExtract the file name from the Attachment FileName property.
strFile = att.FileName
strDocsPath = GetOutputDocsPath
strFileAndPath = strDocsPath & strFile
Debug.Print “File and path: “ & strFileAndPathOn Error Resume NextCheck 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 ThenSave this attachment to a file in the Output Docs folder.
att.SaveAsFile strFileAndPath
End IfOn Error GoTo ErrorHandlerLoad this attachment to the Attachments field of the target table.
With rstTargetAttachments
.AddNew
.Fields(“FileData”).LoadFromFile _
(strFileAndPath)
.Update
End With
Kill strFileAndPath
Next attErrorHandlerExit:
Exit SubErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExitEnd SubSynchronizing Access and Outlook Contacts 11