Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automation error 1

Status
Not open for further replies.

brew2

Programmer
Joined
Apr 29, 2007
Messages
21
Location
US
When trying to use Microsoft Outlook in an app I get an 'Automation Error. The specified module could not be found' error. Here is the code:

Code:
Function SendOutlookMessage(ByVal sSubject As String, _
                ByVal sBody As String, ByVal sSendTo As String, _
                ByVal bShowOnly As Boolean, _
                Optional ByVal sAttachmentFileName As String = "") As Boolean
    
         
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment
       
      ' Create the Outlook session.
    Set objOutlook = New Outlook.Application 'this is where the error is created

end function

Any help would be appreciated. thanks.
 
>the difference is just not worth considering.

I'm afraid I don't agree with you. All performance investments are worth considering, although not always worth adopting. Just because you have more money in the bank doesn't mean that you no longer have to decide how to spend it.

Furthermore, the idea that subsequent versions of a given interface will be inherently incompatible with previous ones is not correct. That would go against the contract implied by COM, which requres backward compatibility. I have not found in my COM experience (primarily MDAC/ADO and my own components) that I have had to rewrite code to accommodate newer versions. Quite the reverse, in fact.

I've never tried to automate Outlook, personally. However, it would be a bit of a round the block workaround to find that early binding would work fine in this situation if one did what MakeItSo suggests in his post. Furthermore, it would be most interesting to recode for late binding and find that you still had to do what MakeItSo suggests in his posts to get things to work. (Am I making it clear yet that I think his suggestion should be investigated?)

I personally don't feel that one should use late binding unless one is quite sure that one must to choose at runtime between two clearly incompatible objects. You are, of course, welcome to disagree with no animosity on my part. :-)

Bob
 
BobRhodes said:
Furthermore, the idea that subsequent versions of a given interface will be inherently incompatible with previous ones is not correct. That would go against the contract implied by COM, which requres backward compatibility. I have not found in my COM experience (primarily MDAC/ADO and my own components) that I have had to rewrite code to accommodate newer versions. Quite the reverse, in fact.
Really? I've had instances where somebody upgraded Excel, and my code no longer worked. I either had to recompile with a reference to the new library, or use late binding. I've had the same issue with Outlook where the users had mixed versions, and I used late binding. Trust me, nobody noticed a performance hit, and it is much easier to maintain than having two versions.

Yes, ADO has never been a problem for me. But Office, don't count on it.

So if Microsoft can't get it right....


 
Fair enough. I can say that Microsoft's "Automation" object libraries perhaps more often meet the criteria that justify late binding than most libraries. Let's see:

1. Newer versions of Office Automation Objects are inherently incompatible with older ones.
2. Automation, with its out of process overhead, is by far the greatest inefficiency that one will encounter.

So, perhaps we can say that late binding is to be preferred when messing with more than one version of any Office Automation product. But I'd still try to avoid it if I could.

Can I go now? :-)

Bob
 
Whew! A lot of discussion. Many Thanks to all who brought my level up at least one notch. I need to ingest all of this stuff and then try to apply.

Thank you.
 
Well, with all the discussion and programming tips, I uninstalled 2007 and then re-installed it. And voila! App works like a charm.

Thanks for all the help. don't know where to start with the stars. maybe one for each?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top