Question : Using Redemption with Late Binding

I'm trying to simply convert this to late biding. Tried a few basic things but keep getting errors.
I'm sure it's a simple syntax fix.  I've viewed a few other reponses in other threads but I keep getting compiling errors.

I tried this but it didn't like all the Dim statements after setting the objOL object

Dim objOL As Object
Set objOL = CreateObject("Outlook.Application")

Dim Application As objOL.Application
Dim objOutlookMsg As objOL.MailItem
Dim objOutlookRecip As objOL.Recipient
Dim objOutlookAttach As objOL.Attachment
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
'Here's my current code snippet
'with early binding

Dim Application As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

Set Application = CreateObject("Outlook.Application")

Dim SafeItem, oItem, Tag
Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
Set oItem = Application.CreateItem(0) 'Create a new message

SafeItem.item = oItem 'set Item property

'etc ......

Answer : Using Redemption with Late Binding

You need to dim EVERYTHING as Object:

Dim Application As Object
Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim objOutlookAttach As Object

Random Solutions  
 
programming4us programming4us