R
red6000
Hi,
I have some code that calls Outlook. Unfortunatley I have to write the code
on a pc with OL2003, but the PC that it will run on is OL2002 (and so the
reference needs to be Outlook 10.0 not 11.0). I can't change the reference
on the pc that it will run on, so I think i need to remove the reference and
use late binding, but I'm struggling. My code is below, what changes do I
need to make?
Public Sub EmailImage(FName As String)
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
MsgBox ("There has been a problem connecting to your email
account and the mail will not be sent")
Exit Sub
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "(e-mail address removed)"
.subject = "***FILEONLY***"
.Attachments.Add Source:=FName
.body = "Please scan the attached document as FILEONLY"
.BodyFormat = olFormatPlain
.Send
End With
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
I have some code that calls Outlook. Unfortunatley I have to write the code
on a pc with OL2003, but the PC that it will run on is OL2002 (and so the
reference needs to be Outlook 10.0 not 11.0). I can't change the reference
on the pc that it will run on, so I think i need to remove the reference and
use late binding, but I'm struggling. My code is below, what changes do I
need to make?
Public Sub EmailImage(FName As String)
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
MsgBox ("There has been a problem connecting to your email
account and the mail will not be sent")
Exit Sub
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "(e-mail address removed)"
.subject = "***FILEONLY***"
.Attachments.Add Source:=FName
.body = "Please scan the attached document as FILEONLY"
.BodyFormat = olFormatPlain
.Send
End With
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub