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 not working 1

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB

For sometime we have used the following coding to send automated emails from VFP9
Code:
oOutlook = Createobject('Outlook.Application')
oNameSpace = oOutlook.getnamespace('MAPI')
oOutbox = oNameSpace.GetDefaultFolder(4)
oItems = oOutbox.Items
oMailItem = oItems.Add(0)
oMailItem.To = "name@myemail.com"
oMailItem.Subject = "test email subject"
oMailItem.Body = "Email body text"
oMailItem.Send
We have moved our software to another computer that has Outlook 2003 installed and when running a test we get the following error from line 1:
Class definition OUTLOOK.APPLICATION is not found
Any suggestions why this isn't working on one computer (standalone with Windows XP) and working another identical computer?

Thank you guys

Lee
 
Lee,

Could this machine once have had Norton AV but it was uninstalled?

run regedt32 and look in HKEY_CLASSES_ROOT for the class "outlook.application".... get the CLSID value then find IT in HKEY_CLASSES_ROOT. (Perhaps copy the CLSID value to the clipboard, then edit/find and paste in the clsid.)

Look in the InProcHandler32 key for that CLSID.... if the value for (default) data is a path to a symantec folder... then just delete the path.

hth

Nigel
 
To me this looks like a broken Outlook 2003 installation. You may have to re-install the office.
 
Hello Lee;

I remember that the old outlook did not use

outlook.application;

For the life of me I cannot remember what was used instead of "application", Trying to find it in my old apps... I am sure someone else here will remember

Sorry could not be of help...
 
Hello guys

Thanks for the replies. I'll try the reinstall and see how that goes. If that fails perhaps there is an alternative command that someone knows of.

Thank you

Lee
 
Lee, my guess is the registry entries have got clobbered. A full re-install should fix it, but you might also get away with just doing a "repair" (from within Office 2003 Setup). It will be much easier.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
That's strange, I posted a reply a couple of hours ago mentioning the issue had been resolved.

I followed the first port of call and looked in the registry and found "outlook.application.11" so I changed the coding accordingly and now it works.
Code:
oOutlook = Createobject('Outlook.Application.[b]11[/b]')
Thanks again all.

Lee


Windows Vista
Visual FoxPro Versions 6 & 9
 
Odd, out of curiosity, I scanned the registry too.
I never found a reference to Outlook.Application, butI did find one to Outlook.Application.11.

However, both of these work for me with no errors:
Code:
oOutlook = Createobject('Outlook.Application')
oOutlook = .null.
RELEASE oOutlook

oOutlook = Createobject('Outlook.Application.11')
oOutlook = .null.
RELEASE oOutlook


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
oOutlook = Createobject('Outlook.Application')
oOutlook = .null.
RELEASE oOutlook

works for me as well with outlook 2007

But than the annoying Outlook message that "a program is trying to sent mail on behalf of me" pops up.
Manual confirmation for 'allowed' is required here.

How to prevent that once you want to sent automated mails from within VFP?

-Bart
 
Hi Bart

I can answer the last for you.

This is not an advert, but I purchased an application called "Clickyesno" which stops that. All you need to do is run the software which does so on start up, ensure Outlook is open when you run your VisFox app and you will not see that pesky message.

If you do a Google search, you should find the software I refer to.

Good luck

Lee

Windows Vista
Visual FoxPro Versions 6 & 9
 
Forgot to mention that "Outlook.application.11" was found in the registry under CLSID > (Then a file with loads of letters and numbers) > ProgID > Default > REG_SZ > Outlook.application.11

Hope that helps

Lee


Windows Vista
Visual FoxPro Versions 6 & 9
 
.11 is for Office 11, and will ONLY work with Office 11 aka 2003. If the version independant class name outlook.application does not work there is something wrong.

Bye, Olaf.
 
Regarding preventing alerts check thread184-1561935 for Craig Boyd's fll.
 
Lee; Glad it worked for you...

Does anybody remember what we used for the older versions with =createobject("outlook.????") ?
It was not "application", for the life of me I cannot remember and cannot find any of my old apps that were not updated, its driving me up a wall...Thanks
 
Well, for what it's worth, I've always used plain "outlook.application", and it's worked under all versions from 97 to 2007.

I've always thought you only need to add the version number if you have multiple versions installed, but I'm not sure about that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike

we have an older app that used outlook.application but for some reason we have to add the .11 for this one. There is only one version of outlook on the computer concerned and that's 2003.

Hope someone can shed light on imaginecorps question.

Thanks again guys

Lee

Windows Vista
Visual FoxPro Versions 6 & 9
 
As far as I know it always was outlook.application. Lee, it's fine if outlook.application.11 works, but be sure you remember it, when outlook is updated to outlook 2007.

If you use the version independant class name you automatically get the newest version. So there is even no need to use a version number on a computer having several office versions installed, unless you have version dependant code, but typically office is very compatible in regard to ole automation.

Bye, Olaf.
 
We previously had an issue with Outlook.Application not working too.
We tracked it down to the following situation:
User previously had Outlook 2003 installed: worked
User installed Outlook 2007 over 2003: worked (automation used 2007)
User didn't like Outlook 2007 and uninstalled: broke

It seems that uninstalling Outlook 2007 didnt reinstate Outlook.Application.11 to Outlook.Application.

We sorted this out by cleaning up the registry.

A quick temporary 'fix' can be had by simply changing references from Outlook.Application to Outlook.Application.11
 
Brigmar,

that sounds very plausible. Maybe the same thing happens, when you deinstall any newest Office Product, the registry does not revert to the previous version, even if one is installed.

But still, even if that is quite some work, de- and reinstalling Office 2003 will work and fix the registry of course.

Maybe this will also work version independant:
o = CreateObjectEx("{0006F03A-0000-0000-C000-000000000046}","")

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top