-
September 8th, 2009, 01:38 AM
#1
VB6 Outlook 2007 automation
Hello,
We have a large VB6 application in our enterprise which normally occupies ~30 MB of RAM.
We have some simple outlook automation in the application, which opens a new message window.
Code reproduced here.
<<
Dim objOutlook As Outlook.Application
Dim objMailItem As Outlook.MailItem
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0) 'The constant olMailItem = 0
objMailItem.To = Recipients
objMailItem.Attachments.Add strAttachment
objMailItem.Display
Set objOutlook = Nothing
Set objMailItem = Nothing
>>
The application works fine with Outlook 2003. With outlook 2007, I get the error 429 "ActiveX component can't create object".
This error doesn't come when I use the same code in a sample application, but comes when used in the large application.
Does VB6 impose any limitations on the process size, which could be leading to this error?
Please also let me know if there are any other ways of achieving the same functionality without resorting to the outlook 12.0 library.
Thanks in advance.
Cheers,
Kiran
-
September 8th, 2009, 11:34 PM
#2
Re: VB6 Outlook 2007 automation
It sounds like you haven't added a Reference to OUTLOOK 2007 in your large application
A reference to OUTLOOK 2003 just may not be doing the job
-
September 9th, 2009, 02:44 AM
#3
Re: VB6 Outlook 2007 automation
@George1111
I am adding the reference. Infact, the outlook object gets created if I initialize it at the beginning of the large application (say X). The problem comes only if I initialize the outlook object after X got completely initialized and running.
The problem here is that even if I open outlook object at the beginning of X , it gets closed if the user closes outlook outside of the application. So I need the ability to create the outlook object when X is up and running.
Please let me know if I am not clear.
Thanks,
Kiran
-
September 9th, 2009, 09:25 PM
#4
Re: VB6 Outlook 2007 automation
So you are saying that actually it is working perfectly until a user opens up Outlook on the same machine ?
BUT
If you work with Outlook 2003 this problem doesn't happen ?
My experience with automation of Office products is that it gets a little screwed up if multiple instances of eg, Excel are running simultaneously
Perhaps the new versions of Office dont like multiple instances at all
I think you better look at this which makes reference to the problem you are having
http://support.microsoft.com/kb/257757
-
September 9th, 2009, 09:35 PM
#5
Re: VB6 Outlook 2007 automation
He might be saying that app X loses it's Outlook object when the user closes Outlook, started after his app is running.
The problem here is that even if I open outlook object at the beginning of X , it gets closed if the user closes outlook outside of the application. So I need the ability to create the outlook object when X is up and running.
Is that close?
-
September 10th, 2009, 01:00 AM
#6
Re: VB6 Outlook 2007 automation
@dglienna
Yes. That is what I meant. The app loses it's outlook object when user closes outlook started outside the app.
@George1111
App X can create Outlook 2003 object when it's up and running. So it was never a problem. Even if the user closes outlook outside of the application, I can always create a new outlook object.
The problem comes when we try to instantiate outlook 2007 object after the app is fully loaded.
Thanks for the link. While the content there was helpful, it didn't address my immediate problem.
-
September 10th, 2009, 01:17 AM
#7
Re: VB6 Outlook 2007 automation
You can check if it's running, and even get it's handle. From there, you could maximize it. More work, but should get the right results.
Not sure about automating email activities. Still pretty locked down.
-
September 10th, 2009, 08:02 AM
#8
Re: VB6 Outlook 2007 automation
I found one reference to automating Outlook which had more than 10 instances running, but as you added an email to one of them, all 10 showed the email - this suggests that while you "think" you have 10 instances, there is in fact only one real instance - this then follows when you close one , you just may be closing ALL (which is what seems to be your problem)
Regardless ....
What may solve your problem is finding ANOTHER way to get into Outlook to do what you may want to do
Google Search on "Outlook Redemption" which is a way of working with Outlook without having to use Outlook Automation
Alternately, depending on how your email is delivered, you may be able to get by with just a simple POPMail VB6 Client (which can read your email accounts without going through Outlook)
-
September 11th, 2009, 01:28 AM
#9
Re: VB6 Outlook 2007 automation
Thanks for the replies. I have already checked Outlook Redemption. As far as I know, it cannot be used to display outlook message items.
I will explore more about Outlook Redemption/POPMail VB6 client and get back here.
-
September 11th, 2009, 06:29 PM
#10
Re: VB6 Outlook 2007 automation
Or, you could get the VSTO Package from MSDN. Visual Studio Tools for Office That allows automation.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|