×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

change to windows 10

change to windows 10

change to windows 10

(OP)
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!

RE: change to windows 10

Win10 comes with newest Office preinstalled but needing your activation/payment.
Try using Outlook.Application.14

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: change to windows 10

(OP)
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

RE: change to windows 10

(OP)
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?

RE: change to windows 10

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

RE: change to windows 10

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
https://www.doschke.name

RE: change to windows 10

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: How to get the best response from the forum first.

RE: change to windows 10

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
https://www.doschke.name

RE: change to windows 10

(OP)
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

RE: change to windows 10

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 o = CREATEOBJECT("Outlook.Application.14"), 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 o = GetObject(,"Outlook.Application.14")? (The skipped first parameter and thus the comma directly after the opening bracket is no typo here).

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: change to windows 10

(OP)
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 :(

:((


RE: change to windows 10

(OP)
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.

:(

RE: change to windows 10

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
https://www.doschke.name

RE: change to windows 10

(OP)
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!

RE: change to windows 10

Reinstall Outlook.

RE: change to windows 10

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
https://www.doschke.name

RE: change to windows 10

(OP)
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

RE: change to windows 10

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
https://www.doschke.name

RE: change to windows 10

(OP)
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

RE: change to windows 10

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
https://www.doschke.name

RE: change to windows 10

I repeat: reinstall Outlook.

RE: change to windows 10

(OP)
Hi,

Unfortunately I still get an error with the "GETobject" and a Reinstall of Outlook is unfortunately not feasible at this time either. I'm going to abandon this and try to find a work around with the way the data is supplied.

Thank you all for all your help & I appreciate all the time everybody took.

Thanks,
FOXUP!

RE: change to windows 10

(OP)
Hi,

Just to follow-up, I reread the posts and remembered the post from Mike Lewis.

I just uninstalled Outlook 2016, and the problem went away. :) Star Mike.


Thanks again to all,
FOXUP !

RE: change to windows 10

In practice the same as I suggested.

RE: change to windows 10

Well, you got it to work as I see.

GETObject wouldn't need correct registry keys, as it looks for monikers in processes already running. And since you could start Outlook it was a sure shot this will work. And it did according to your own reports. The old code now working after the new Office is uninstalled puzzles me, as specific outlook version PROGID should also work, then. Sounds like something is a mess in your system.

You might want to look into a full fresh reinstall of everything in the long run.

Besides, lucky you, I don't see any uninstall option in programs and features.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: change to windows 10

Foxup, I'm glad I was able to help. I was thinking of reminding you of my suggestion, but I assumed you had already tried it unsuccessfully. Anyway, it's good to hear that the problem no longer exists.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close