[AccessD] Outlook Automation
John Colby
jwcolby at gmail.com
Fri Mar 22 22:45:52 CDT 2024
I suggest that you do both early and late binding. Use a global compiler
constant to switch it. In your code, bracket the early and late code
segments with #if statements. Use early to figure it out then go to late
for production. AFAIK you can do anything in late that you can do in
early, you just have to know the syntax to get to the properties of things
as well as what things are called. Any object in the library can be pulled
as object.
The problem is that you simply cannot do "Dim X withevents" in late
binding. The compiler can't figure out the events that an object is going
to have. So automation isn't possible in late binding. For this dev
environment I suggest getting a copy of Office 2013 and dev in that and
reference that.
On Thu, Mar 21, 2024 at 6:59 PM Rocky Smolin <rockysmolin2 at gmail.com> wrote:
> Dear List:
>
> I am trying to create an email through Automation using late binding (in
> case the target machine does not have access loaded; I check for that first
> and bail if no outlook).
>
> My DIMs:
>
> Dim myolApp As Object
> Dim myItem As Object
>
> Code:
> myItem.To = Me.fldTenantEmail
> myItem.cc = "Kathy.Klein at arensgroup.com"
> myItem.Subject = "Rent Increase Notice - " & Me.fldTenantCompany & " - " &
> me.fldTenantAddress & ", " & Me.fldTenantSuiteNumber
>
> The lines for .Subject and .CC work but Myitem.To fails with Method 'To' of
> object '_MailItem' failed.
>
> Me.fldTenantEmail contains Armando at fallbrookirrigation.com
>
> If I substitute xx for Armando at fallbrookirrigation.com then it works. I'm
> thinking it may have something to do with the special characters?
>
> But I have cribbed this code from another app that works.
>
> Any ideas?
>
> MTIA
>
> Rocky
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
John W. Colby
Colby Consulting
More information about the AccessD
mailing list