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!
 
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!
 
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 !
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top