I've been using the code from FAQ.702-2921 with much success until I came up against this problem:
The Access database which fires off the email is on 'G:\' drive, whilst the object I wish to programmatically attach to the email is on 'X:\' drive,
When I run the code I'm getting a Microsoft Access dialogue box which states: 'The system could not find the path specified' I have permissions to both drives. I've tried changing the code to look at an object on the 'G:\' drive, and the code attaches it just fine - anyone know why this behaviour should be, and what to do to get around it?
Briefly, here is the code again:
Laters, Z
"42??? We're going to get lynched!
The Access database which fires off the email is on 'G:\' drive, whilst the object I wish to programmatically attach to the email is on 'X:\' drive,
When I run the code I'm getting a Microsoft Access dialogue box which states: 'The system could not find the path specified' I have permissions to both drives. I've tried changing the code to look at an object on the 'G:\' drive, and the code attaches it just fine - anyone know why this behaviour should be, and what to do to get around it?
Briefly, here is the code again:
Code:
Dim email As String, ref As String
Dim notes As String
Dim objOutLook As Object
Dim objEmail As Object
Set objOutLook = CreateObject("OutLook.Application")
Set objEmail = objOutLook.CreateItem(olMailItem)
ref = "Subject Line"
email = "A.N.Other@SomeAddress"
notes = "Hello A..."
With objEmail
.To = email
.Subject = ref
.Body = notes
.Attachments.Add ("X:\somefolder\somefolder\somefile.xls") 'add attachment
.Display
End With
Laters, Z
"42??? We're going to get lynched!