Packaging for multiple office versions

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I need to package one of my access apps and send to clients. My app calls
outlook to send emails. The problem is that client pcs can each have a
different version of outlook (2000, xp, 2003 etc.). How can I package my app
that it will work with any version of outlook?

Thanks

Regards
 
What you want is Late Binding.

Rather than set a reference to Outlook (which is linked to a specific version),
you would do something like this ...

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

The problem is that you don't get intellisense when you do this, so I usually
write my code with bound objects, using a specific reference, and then unbind
them before delivery ... or whenever I'm done working with the objects.
 
John said:
Hi

I need to package one of my access apps and send to clients. My app
calls outlook to send emails. The problem is that client pcs can each
have a different version of outlook (2000, xp, 2003 etc.). How can I
package my app that it will work with any version of outlook?

Late binding. This allows you to make use of external libraries without
setitng a reference to them and (for the most part) makes the code version
independent.
 
I am using

Private WithEvents objOutlook As Outlook.Application

and if I change it to

Private WithEvents objOutlook As Object,

I get the error Compile Error, Expected: Identifier on the word Object. Any
way to fix this?

Thanks

Regards
 
Unfortunately, I don't believe you can use Late Binding in conjunction with
WithEvents.
 
I have no interest in changing or criticizing anyone's practice of
automating Outlook in order to send e-mails.

I used to do this myself. I wrote my first code to do so about eight
years ago. Not so surprisingly there was a discussion then about early
and late binding.

I note there are many posts to CDMA outlining problems with automating
Outlook. I had problems myself, notably when system administrators
enetered fake addresses into system address books in order to confuse
the Melissa virus. They were successfull and they were also successful
in disabling an address search in my application. As they didn't tell
anyone, let alone me, of their covert activity, I was at a loss to
explain why the application worked one day, but not the next. [My first
rule of Access is: It's IT ('s fault).]

For beginners or non-previous-email senders who lurk I would like to
point out that beginning with Windows 2000, Microsoft has provided us
with CDO. CDO is implemented through CDOSys.Dll. CDO sends mail
quietly, simply, quickly, without warning messages and without fuss. I
use CDO now, I don't use Outlook.
 
More's the &^%$#$!@ pity.

Some of the SMTP mail components have terrific functionality, but also
use WithEvents. Since my own rule is "no early binding", I can't use
any of those components.

TC
 
Lyle said:

In AC97 (on WinXP PC) I get "Can't add a reference to the specified
file" when I try to add the reference to cdosys.dll (via Browse). If I
Look through my References, I find that there is one called Microsoft
CDO for Exchange 2000 Library (CDOEX.DLL). This seems to be the Exchange
(vs SMTP) version of CDO, I don't think this will help unless I was
runing Exchange. Since it doesn't show up in the listed references I
thought maybe that cdosys.dll needed to be registered, but regsvr32
gives an error message that it failed to register. Any ideas?
 
Bri said:
In AC97 (on WinXP PC) I get "Can't add a reference to the specified
file" when I try to add the reference to cdosys.dll (via Browse). If I
Look through my References, I find that there is one called Microsoft
CDO for Exchange 2000 Library (CDOEX.DLL). This seems to be the
Exchange (vs SMTP) version of CDO, I don't think this will help unless
I was runing Exchange. Since it doesn't show up in the listed
references I thought maybe that cdosys.dll needed to be registered,
but regsvr32 gives an error message that it failed to register. Any
ideas?

--
Bri

ps. Tried to set the reference in VB6 as well (via Browse) and it
didn't give me an error message, but it did NOT add the reference
either.


I"m sorry that I don not know what this problem is. I'm "pretty" sure I
have used CDO in Access 97 but I cannot check that now.

I suspect using late binding will not work but myabe it's worth a try.
Examples of late binding a la VB Script (to be used in ASP) can be found at
http://www.w3schools.com/asp/asp_send_email.asp
They should work in Access 97 VB without much change.
 
Lyle said:
I"m sorry that I don not know what this problem is. I'm "pretty" sure I
have used CDO in Access 97 but I cannot check that now.

I suspect using late binding will not work but myabe it's worth a try.
Examples of late binding a la VB Script (to be used in ASP) can be found at
http://www.w3schools.com/asp/asp_send_email.asp
They should work in Access 97 VB without much change.

Thank you for that example. I modified your example code to use the late
binding and it worked perfectly.

Dim iCfg As Object
Dim iMsg As Object
Set iCfg = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")
'the rest is the same as Lyle's original example
 
Bri said:
Thank you for that example. I modified your example code to use the
late binding and it worked perfectly.

Dim iCfg As Object
Dim iMsg As Object
Set iCfg = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")
'the rest is the same as Lyle's original example

Great! :-)
 
I can't get the CDO function to work with my Access 2003 database
application.
I'm getting a "The transport failed to connect to the server" error.
I don't understand what I'm missing. I'm using gmail as the smtp server
with my userid and password.
Can someone please help me with a good example?
Thanks!
Ted
 
What URL have you used? (I bet it wasn't just "gmail".)

Normally you should do a DNS MX query on a domain name, to get the
address of the SMTP server for that domain.

HTH,
TC
 
Ted said:
I can't get the CDO function to work with my Access 2003 database
application.
I'm getting a "The transport failed to connect to the server" error.
I don't understand what I'm missing. I'm using gmail as the smtp server
with my userid and password.
Can someone please help me with a good example?
Thanks!
Ted

I guess there is no Internet connection at the time the code runs.
I remember getting the same error when using the cdo-code with a dial-up-connection.

Arno R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top