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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change to windows 10 1

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
hi,

I have recently changed my PC to windows 10 with outlook 2010. I have this code which worked fine on Windows 7-64 bit with outlook 2003.


oOutLookObject = CREATEOBJECT("Outlook.Application")
olNameSpace = oOutLookObject.GetNameSpace("MAPI")
olFolder="G Suite - myname.myname@domain.ca"

myFolder="Inbox"
objFolder1=olNameSpace.Folders(olFolder)
objFolder=objFolder1.Folders(myFolder)
myAtts=objFolder.Items

FOR EACH loItem IN myAtts
IF loItem.attachments.COUNT >0 && Make sure there is an actual attachment.
FOR i = 1 TO loItem.attachments.COUNT
lcFilename=""
lcFilename = loItem.attachments.ITEM(i).filename
lcFilename = ALLTRIM(lcPath)+lcFilename
loItem.attachments.ITEM(i).SaveAsFile(lcFilename)
NEXT
ENDIF
NEXT


which crashes now.
It opens a "Welcome to Outlook 2016" window (which I have no idea why because I use outlook 2010). and then it crashes with "Ole disptach excpetion code 4096"
can anybody please help.

Thank you,
FOXUP!
 
I tried that and I still get the "welcome to Outlook 2016" splash screen coming up asking me to install outlook 2016 :((

Please help, thanks,
FOXUP
 
to help in this problem, I opned a dos prompt and typed "Outlook" and it launched the "welcome to outlook 2016". perhaps the "default outlook" is not the 2010. Any ideas?
 
This might sound obvious, but did you actually install Outlook 2010? If so, you could then uninstall Outlook 2016 (unless you want to activate [and pay for] it, in which case the problem should go away).

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Outlook.Application will start the latest/default, if .14 doesn't work, try Outlook.Application.13 or Outlook.Application.12, that's the only way to address a specific version.

Mike, I didn't yet manage to uninstall Office and get rid of the "Welcome to your new Office" welcome screen of Windows 10. It sometimes comes up after restart and it always comes up ofter an update of windows to a new major build version. I'm actually still having Office 2007 and use it so rarely, that I don't see a reason to update, I also don't have any Office automation projects for which I'd need that.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Take a look in the 'default programs' in Windows settings and make sure the Email portion points to the correct version of Outlook.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
To prevent any misunderstanding or wrong expectations: Which version of outlook starts with Outlook.Application is totally independent of what default mail client is configured for Windows.
The first is a topic embedded in OLE classes, which always offer a version independent CLSID, that is typically associated with the latest version and several defaults for software is associated with file extensions or certain default protocols/services like http or mail (eg default browser, default mail client).

Configuring the latter therefore will still not change what Outlook starts with Outlook.Application, if you ask me to let that be Office2007, you'd need to manually point the registry keys that way, and that's not a thing I'd recommend, as the keys of an OLL Server are distrubuted in several root key stores in the registry and 32bit virtual keys and more are not making this simpler.

What the default mail client configuration will change is Windows reactions - for example to clicks on "mailto:"-links and last not least to the MAPI mail system, MAPI requests. So Mike Gagnon's advice would mainly work, if you automated mail the MAPI way, but I still prefer the Outlook.Application automation, or Outlook.Application.N, to get a specific Outlook version. It's unfortunate how Microsoft sabotages OLE automation with its halfways preinstalled newest Office version, but to deal with it using the main version should help. I know 12 is for Office 2007, I assumed 14 would be 2010, you might need 13.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Ive tried the Outlook.Application.N (from 10 to 18) gave up after that. Seems to keep opening up the "welcome to Outlook 2016". Any other ideas please as I have over 500 attachments and that script would download them all at once which was a great help. Any ideas ? :((

Thanks,
FOXUP
 
Wikipedia says Office 2010 is main version (codename) 14, so Outlook.Application.14 should be it. Is there a difference, if you first start Outlook, and then do [tt]o = CREATEOBJECT("Outlook.Application.14")[/tt], and last not least do you get an error message aside of the unwanted Office 2016 welcome screen?

And/or start Outlook manually and then do [tt]o = GetObject(,"Outlook.Application.14")[/tt]? (The skipped first parameter and thus the comma directly after the opening bracket is no typo here).

Bye, Olaf.

Olaf Doschke Software Engineering
 
I tried as you said:

started outlook then opened vfp (with outlook opened in background), and typed in:
o = CREATEOBJECT("Outlook.Application.14")

It "hung" for about 30 secs
then gave error OLE Error code 0x80080005: Server execution failed.

with both of them still opened, back in vfp, typed:

o = GetObject(,"Outlook.Application.14")

got nothing back :(

:((


 
tried this to see what i can get:

TRY
oOutlook = getobject(,"Outlook.Application")
lbrunning = .t.
CATCH
*** Outlook is not running, start it up
oOutlook=createobject("Outlook.Application")
lbrunning = .f.
ENDTRY
MESSAGEBOX(IIF(lbrunning,[yes],[no]))

with outlook opened i get "yes". with outlook closed, I get "no" and it doesnt open.

:(

 
Well, at least you get a foot in the door, if outlook runs. Now simply RUN /N outlook.exe to get it up. It's a hack, but would work.

The other obvious thing to try is a repair installation. If you get a "Server execution failed" error, that can have all kinds of reasons, but likely also some wrong reg keys or missing DLLs.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hi,

No luck with the "RUN /N outlook.exe". It runs the "outlook 16 - Welcome" splash screen :(

Any other suggestions? :(

Any way of getting all these attachments another way? :(

Thanks,
FOXUP!
 
Of course, you have to start the outlook.exe in exactly the right path within programs, your Office 14 outlook.exe

And I agree with Tore, reinstalling your office, as I also suggested as another possible fix, likely will set the reg keys for Outlook.Application.14 back to work.

Bye, Olaf.

Olaf Doschke Software Engineering
 
I got it to execute this:

"RUN /N C:\Program Files\Microsoft Office\Office14\outlook.exe" which opens the correct outlook.
The rest of the program from my original 1st post doesn't work however.
I have this now:

RUN /N C:\Program Files\Microsoft Office\Office14\outlook.exe
olNameSpace = oOutLookObject.GetNameSpace("MAPI")
olFolder="G Suite - ffff.gggg@ffffff.ca"
myFolder="Inbox"
objFolder1=olNameSpace.Folders(olFolder)
objFolder=objFolder1.Folders(myFolder)
myAtts=objFolder.Items

I get the error " OBJECTEXT oOutLookObject is not found". Please help.


Thanks,
FOXUP
 
You skipped a few steps. When you run outlook.exe, you still don't have oOutlook, the next step then is
Code:
oOutlook = getobject(,"Outlook.Application")

Bye, Olaf.


Olaf Doschke Software Engineering
 
Im back to the error of "OLE Error code 0x80080005: Server execution failed." :(

I do this :

RUN /N C:\Program Files\Microsoft Office\Office14\outlook.exe
oOutLookObject = CREATEOBJECT("Outlook.Application")
olNameSpace = oOutLookObject.GetNameSpace("MAPI")
olFolder="G Suite - me.me@my_office.ca"
myFolder="Inbox"
objFolder1=olNameSpace.Folders(olFolder)
objFolder=objFolder1.Folders(myFolder)
myAtts=objFolder.Items

FOR EACH loItem IN myAtts
IF loItem.attachments.COUNT >0 && Make sure there is an actual attachment.
FOR i = 1 TO loItem.attachments.COUNT
lcFilename=""
lcFilename = loItem.attachments.ITEM(i).filename
lcFilename = ALLTRIM(lcPath)+lcFilename
loItem.attachments.ITEM(i).SaveAsFile(lcFilename)
NEXT
ENDIF
NEXT

wow, out of over 128 programs (migrated from old pc to new pc), this is the only one I can't working :( Of course, it's the one with over 500 emails that I need to download :( LOL

Going round and round, back to the error of "OLE Error code 0x80080005: Server execution failed."

any help please.
thanks,
foxup
 
We have introduced RUN /N to let GETobject working, not CREATEobject.

Is it really that hard to understand a concept? I asked you to start Outlook manually and then try GETobject, and that worked.
Then I asked you to start outlook via RUN instead of manually starting outlook.

This is still about the alternate solution to use GETobject, but fully automatic. Do you understand the difference of GET and CREATE? CREATE has no prerequisite, you CREATE your object. GET means you GET something already running. The whole idea s to do RUN and GET instead of CREATE.

Bye, Olaf.


Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top