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

Display saved email via VB interface 1

Status
Not open for further replies.

Doug4Now

Programmer
Apr 22, 2002
34
AU

In the project that I am working on I have used the following code...

Code:
Dim objWord As Object
Set objWord = CreateObject("[COLOR=blue]Word.Application[/color]")
objWord.[COLOR=blue]Documents[/color].Open ([path to document])
objWord.Visible = True

which is working well. This launches Word and displays the document.

I have been requested to build in the functionality to view emails from VB. I can load them into Word but it displays all of the HTML baggage as well as the email text.

I assume that I will need to code it along these lines...

Code:
Dim objEmail As Object
Set objEmail = CreateObject("[b][COLOR=blue]__???___[/color ][/b].Application")
objEmail.[b][COLOR=blue]__???___[/color][/b].Open ([path to email])

Can someone tell me what is the .Application that I should use ? I've tried - Email / Mail / Outlook - but none of those worked. Just get an "ActiveX can't create object" err.message

Many thanks in anticipation.

Doug.
 
I notice that although you've asked 20 questions (and got quite a lot of answers) you haven't marked any of the answers as being helpful. You may find that faq222-2244 will help you get better answers and show how to acknowledge them.

For this question the application you're looking for is Outlook. (This won't work with Outlook Express). You need to open the MAPI namespace, then open the Inbox folder. You can then access the items:

Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set myfolder = nms.GetDefaultFolder(olFolderInbox)
myfolder.Display
Set myitem = myfolder.Items(1)
myitem.Display

This is a snippet only - you will need to do all appropriate declarations, and (as with all CreateObject constructions) quit the application and set the Object to Nothing when you're finished.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 

Thanks John,

I'll give it a try.

Regarding the acknowledgement of helpful answers, there have been a number of times that I have clicked the "Thank ...... for this valuable post!" but it never seems to have worked at the time - I thought that perhaps it took a while to update. Just tried turning my Pop-up-stopper off and saw what was meant to happen... we live & learn.

Doug.
 
You're welcome, and Thanks! [smile]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top