Outlook Express


Added "Microsoft MAPI Control 6.0" in Component of this project
Added "Microsoft Outlook 11.0 Object Library", "Microsoft Scripting Runtime" & "Microsoft CDO 1.21 Runtime Library" in Reference of this Project.

Below is the process for reading messages from INBOX on Command Button Click Event.
When Run this project, It goes to the OutlookNotStarted Error.
My Outlook Express is configured well with necessary data and mails are daily incoming & outgoing.

Private Sub Command1_Click()
Dim OLApp As Outlook.Application
On Error GoTo OutlookNotStarted
Set OLApp = CreateObject("Outlook.Application")

' Dim mNameSpace As NameSpace
' On Error GoTo NoMAPINameSpace
' Set mNameSpace = OLApp.GetNamespace("MAPIFolder")

Dim ms As New MAPI.Session
Dim myFolder As MAPIFolder
Set myFolder = OLApp.Session.PickFolder
Dim myStoreId
Dim myFolderId

myStoreId = myFolder.StoreID
myFolderId = myFolder.EntryID
Me.Caption = myFolder.Name

Dim cfolder As Folder
OLApp.Session.Logon "rajnirmalkar@vnrseeds.com", "1234"
' ms.Logon "rajnirmalkar@vnrseeds.com", "1234"
' Set cfolder = ms.GetFolder(myFolderId, myStoreId)
' Me.Caption = cfolder.Name

Dim Mails As MailItem
' Set Mails = mNameSpace.GetDefaultFolder(olFolderInbox).Items
Dim mMail As MailItem
Dim mStr As String, iCount as Integer

iCount=0
For Each mMail In Mails
mStr = mMail.Recipients + " " + mMail.Subject + " " + CStr(mMail.ReceivedTime)
iCount=iCount+1
ListView1.ListItem.Add iCount, mStr 'append messages in the ListView Control
Next
mMail.Close (olDiscard)

Set Mails = Nothing
' Set mNameSpace = Nothing
Set OLApp = Nothing
OLApp.Quit
Exit Sub

OutlookNotStarted:
MsgBox "Could not start Outlook Express!", vbCritical
Exit Sub
NoMAPINameSpace:
MsgBox "Could not get MAPI NameSpace!", vbCritical
Exit Sub
End Sub
Posted On: Monday 24th of December 2012 01:11:09 AM Total Views:  241
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




sending a group email in VB6 and outlook express

Im trying to develope a program to automatically send out an email to a group set up in outlook express and it doenst seem to want to do it. Im using MAPI control. I can set the recep. as a single email address and it works perfect, but if i set it to the group name it will not send. anyone have any ideas\t im under the gun on this one and cant find an answer anywhere.
VIEWS ON THIS POST

94

Posted on:

Friday 12th October 2012
View Replies!

Attaching more than one file to an outlook message

I have an Access Database that Generates about 20 different reports on a weekly basis. I have a table that contains a list of email addreses of the different people who are to receive these reports. (Not gets all 20 Reports.) The table,Via a Form, also allows users to select as many reports as they wish to receive weekly. I am able to attach a single report to an outlook email and send it, how do I get my databse to export the correct reports to the correct people. Any advice is greatly appreciated.
VIEWS ON THIS POST

68

Posted on:

Friday 12th October 2012
View Replies!

ms outlook macro help

I have an webtracker script on my website that sends me an email (with the visitor info) each time a page is visited. Now I have a zillion emails and they all follow the exact same format. for example: IP: 123.45.67.8 Date: 1/24/04 Referer: yahoo.com etc, etc.... I know I can import into a text file and then run a macro that gets rid of the IP,Date,Referer headings but it is a huge file and there has to be a better way, perhaps by using a macro in Outlook instead. But I've never coded a macro in outlook so I have no idea if its the same as doing one for word. Any suggestions
VIEWS ON THIS POST

61

Posted on:

Friday 12th October 2012
View Replies!

Add button in outlook

Can any one help me in adding a button in outlook Actually I want a button on Outlook. When user clicks on that button and sends any mail then that mail has to be trapped. Should I use any dll which will do the work Can any one help me with any logic Please reply.
VIEWS ON THIS POST

159

Posted on:

Friday 12th October 2012
View Replies!

restrict in outlook not work

For test i write this code: ... Set olFld = olNsp.GetDefaultFolder(6).Parent.Folders("SERV") Set olItm = olFld.Items.Find("[SenderName]='gss.italy@iol.it' ") For Each olItm In olFld.Items If Right(olItm, 5) = "FORTI" Then TEST = olItm.ReceivedTime Set olItm = olFld.Items.restrict("[SenderName]='gss.italy@iol.it' AND [ReceivedTime]= '" & TEST & "'")If olItm.Count > 0 Then MsgBox "Item found!", vbExclamation End If End If Next... for testing WHY the code not set the correct email with the same parameter into the loop I have always the olItm.Count= 0 or = nothing dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf' dp.SyntaxHighlighter.Highlight('25484d905bcd4b63a8618d27ec2de9ed')
VIEWS ON THIS POST

82

Posted on:

Saturday 13th October 2012
View Replies!

Capturing outlook object

hello - I am relatively new to the access/vb/outlook interoperability world. the code (below) I have created is intended to grab the first item in a folder in outlook (the looong id 0000....) and populate fields in an access database. it almost works. with the GetFirst and GetNext method I can add only two records to my table and then I am stuck in an endless loop. I have tried to manipulate the do while statement but have been unsuccessful. I thought this was pretty straight forward - is there something I am missing. any help would be appreciated much obliged! /jh **************************************** Dim MySender As String Dim MyBody As String Dim MyDate As String Set myOlApp = CreateObject("Outlook.Application") Set myNamespace = myOlApp.GetNamespace("mapi") Set myFolder = myNamespace.GetFolderFromID("000000001A447390AA661 1CD9BC800AA002FC45A03008AF33D269C7B1B46BB0DF67728F D80A600000031F27C0000") Set MyItem = myFolder.Items.GetFirst Do While MyItem "" 'On Error Resume Next MySender = MyItem.SenderName MyBody = MyItem.Body MyDate = MyItem.SentOn StrQuery = "" StrQuery = "Insert Into tblDataTaskReq(datRequestDate,memDescription) Values('" & MyDate & "','" & MyBody & "');" DoCmd.SetWarnings False DoCmd.RunSQL StrQuery DoCmd.SetWarnings True Set MyItem = myFolder.Items.GetNext Loop
VIEWS ON THIS POST

96

Posted on:

Saturday 13th October 2012
View Replies!

Sending rtf, doc, text as message body in outlook 2003 in vb.net

I am trying to send a document using vb.net and outlook and words, The type of file i would like to send are (rtf, doc, txt) as the message body in the outlook message. Any one with experince in this area the help will be surely appreciated. I have added the code below i get some type of hresult type error when i run this. Public Sub SendDocMsg(ByVal subjectp As String, ByVal pEmail As String, _ ByVal fileDirLocation As String) recipient = pEmail subject = subjectp Dim oLApp As Object Dim oItem As Object Dim oDoc As Object On Error GoTo errorHandler 'Create a new mailitem ' oOutlook = New Outlook.Application oLApp = CreateObject("Outlook.Application") oItem = oLApp.CreateItem(0) oDoc = CreateObject("Word.Application") oDoc.Visible = True oDoc.Documents.Open(fileDirLocation) With oItem 'Set the recipient for the new email .To = mRecipient 'Set the recipient for a copy '.CC = "recipient2@mail.com" 'Set the subject .Subject = mSubject 'The content of the document is used as the body for the email .Body = oDoc.ActiveDocument.Content .Send() End With errorHandler: MsgBox(Err.Number & " " & Err.Description) 'Clean up oItem = Nothing oLApp = Nothing oDoc = Nothing End Sub ' SendMsg
VIEWS ON THIS POST

100

Posted on:

Saturday 13th October 2012
View Replies!

sending email via outlookobject in VB, weired thing

i wanted to be able to send an email with attachement for this i created an outlook object and i filled in all the parameters and it creates the message successfully with the attachement and everything, but when i press send instead of sending the email to the recpient it puts it in the sent items without sending it, unless i opened my outlook and looked into the sent emails box then it sends it, i dont know if i can do something in order for the email to be sent automatically because i dont know if the problem is the code or it s a sort of security thing for outlook if anyone has an idea.......................
VIEWS ON THIS POST

101

Posted on:

Saturday 13th October 2012
View Replies!

how to set a default From / reply to header in an outlook mail using vba/vba ??

I need an option to set a default from address or reply to address when someone creates a new mail of a reply. I thought this could be done using a macro in outlook, but I honestly don't have a clue how to do this ... Any suggestion would be appreciated. Thanx, Marc
VIEWS ON THIS POST

94

Posted on:

Saturday 13th October 2012
View Replies!

How to create folders(outlook)

ThanksBalakumar | Post Points: 35 lazyjay Tucson, AZ Since 4/10/2002 Posts 3,121 Reputation 30,215 Reply Jason Isaacs (lazyjay) replied on 5/17/2004 3:24 PM rated by 0 users Hi Balakumar,Assuming you have permission to add new folders to the public folders, it would be something like... (this is in Outlook VBA... You'll have to add the references to do it from VB, and instciate the Session object explicitly... but the code should be just about the same)Code:Sub MakeFolders()\t\tDim objPublicFolder As Outlook.MAPIFolder\t\tDim objPublicFolders As Outlook.MAPIFolder\t\t\t\t'get the "public folders" folder\t\tSet objPublicFolder = Session.Folders("Public Folders")\t\t'get the " Public Folders" child of "Public Folders"\t\tSet objPublicFolders = objPublicFolder.Folders(" Public Folders")\t\t\t\t'add the folders you want\t\t' the 8 + part has to be there for child folders that you create\t\tobjPublicFolders.Folders.Add "My appts", 8 + OlItemType.olAppointmentItem\t\tobjPublicFolders.Folders.Add "My Contacts", 8 + OlItemType.olContactItem\t\t\t\t'clean up\t\tSet objPublicFolders = Nothing\t\tSet objPublicFolder = NothingEnd SubHope this helps
VIEWS ON THIS POST

68

Posted on:

Saturday 13th October 2012
View Replies!

sending with outlook 2007

i made an email blast program in vb6. i am using microsoft outlook 2003 to send the emails, i want to use microsoft outlook 2007. how am i gonna do that i have attached my program below
VIEWS ON THIS POST

108

Posted on:

Tuesday 16th October 2012
View Replies!

Email in VB6 with outlook express

I just need simple code to email. Building the program on computer using ME and will be using the program on computer running windows 7, and just want load default email program outlook express. I need to load values, into the subject line, from text boxes and list boxes depending on selections. I also need to put into the body section text value selections along with two images. The emails will be sent from different command buttons and want to load the email addresses via text files. Please help.
VIEWS ON THIS POST

96

Posted on:

Thursday 18th October 2012
View Replies!

Reading from different email account in outlook

I have outlook 2007 , and I configured 2 email accounts in it. When I run my code it picks up from my default profile and not from other account I added. Can some one help me how to use the other email account as default account. Public Sub ReadEmails() Dim OlApp As Outlook.Application Dim Inbox As Outlook.MAPIFolder Dim Sent As Outlook.MAPIFolder Dim Destfolder As Outlook.Folder Dim IbboxItems As Outlook.Items Dim SentItems As Variant Dim TestFolder As Outlook.MAPIFolder Dim Subject As String Set OlApp = CreateObject("Outlook.Application") Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox) ' This picksup my default inbos not the Inbox from other account I added to my outlook. Set InboxItems = Inbox.Items Set Destfolder = Inbox.Folders("Testeanalyst") SentItems.GetLast.Move Destfolder End Sub
VIEWS ON THIS POST

142

Posted on:

Thursday 18th October 2012
View Replies!

Re: Updating outlook with via the GUID

Greetings , I am trying to figure out how to update outlook appointments via the GUID that is produced. Currently, I store the GUID in a database and would like to update outlook via a loop for a number of appointments grouped by individual in my program. Any insight and advice would be appreciated.
VIEWS ON THIS POST

142

Posted on:

Thursday 18th October 2012
View Replies!

Text Formating when exporting data from excel to outlook

Hi Guys I am creating a email from a single row of excel data and it works fine apart from the fact that I cant figure out how to format the text as bold. we are using outlook and html formating. I have created the text i would like to output in bold. vb Code: Sub SendEMail() Dim Email As String, Subj As String Dim Msg As String, URL As String Dim r As Integer, x As Double r = InputBox("Row Prompt", "Enter Row Number", "Enter Valid Row")' For r = 2 To 2' Get the email address Email = "jonnymac@company.com" ' Message subject Subj = Cells(r, 1) & "Report"' Compose the message Msg = "" Msg = Msg & "[B]CLIENT [/B]" & vbCrLf & Cells(r, 1) & vbCrLf & vbCrLf Msg = Msg & "[B]DATE[/B] " & vbCrLf & Cells(r, 2) & vbCrLf & vbCrLf Msg = Msg & "[B]TIME [/B]" & vbCrLf & Cells(r, 3) & vbCrLf & vbCrLf Msg = Msg & "[B]TYPE[/B] " & vbCrLf & Cells(r, 4) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 5[/B] " & vbCrLf & Cells(r, 5) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 6[/B] " & vbCrLf & Cells(r, 6) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 7 [/B]" & vbCrLf & Cells(r, 7) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 8[/B] " & vbCrLf & Cells(r, 8) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 9[/B] " & vbCrLf & Cells(r, 9) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 10[/B] " & vbCrLf & Cells(r, 10) & vbCrLf & vbCrLf Msg = Msg & "[B]Field 11[/B] " & vbCrLf & Cells(r, 11) & vbCrLf & vbCrLf Msg = Msg & "[B]Field12[/B] " & vbCrLf & Cells(r, 12) & vbCrLf & vbCrLf ' Replace spaces with %20 (hex) Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20") Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20") ' Replace carriage returns with %0D%0A (hex) Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A") ' Create the URL URL = "mailto:" & Email & "subject=" & Subj & "&body=" & Msg' Execute the URL (start the email client) ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus' Wait two seconds before sending keystrokes Application.Wait (Now + TimeValue("0:00:02")) Application.SendKeys "%s"' Next rEnd Sub
VIEWS ON THIS POST

157

Posted on:

Wednesday 24th October 2012
View Replies!

XML import

Anyone have VB6 code to read in from a xml file...
VIEWS ON THIS POST

116

Posted on:

Tuesday 20th November 2012
View Replies!

Getting Error 429 in XP

I have a program which was developed with VB5Pro under Win98SE. A Client needs it to run under WinXP. I decided to install VB5 on his machine so I can make and debug the needed changes in that environment. WinXP ...
VIEWS ON THIS POST

66

Posted on:

Wednesday 21st November 2012
View Replies!

Vb6 decompiler do exist?

Can anybody tell me does the vb6 decompiler exist.. somebody said yes yet somebody said no.. im very new to this and i do need decompiler if someone have it.. i got an exe. file and i hope i can read its source code because i lost the original source code of its exe. do anyone have decompiler of it.. i can send you the exe and hope you can give me the full coding of the exe if can.. much appreciated...
VIEWS ON THIS POST

129

Posted on:

Wednesday 28th November 2012
View Replies!

How to get a total of multiple textboxes in a textbox?

all here's is my current code: (NOT WORKING) TextBox1.Text = TextBox2.Text + TextBox3.Text I actually need that but + 4 + 5 + 6 etc. Up to 10 TextBoxes and I can't find a way to get it to work. So if someone got tips or the awnser please reply.
VIEWS ON THIS POST

79

Posted on:

Wednesday 28th November 2012
View Replies!

VB AI Help

Ok I am in the process of making my tic tac toe program. I finished a 2 player game. I need help on my 1player game with AI. I just need help on a simple AI. So when I click a picture box a random picture box is selected for the AI, no intelligence needed. Ok I am using picture boxes. I have 27. 8 blanks, 8X's and 8 O's. I created arrays for all of them: Private Sub frmTicTacToe_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load picBlank(0) = picNone1 picBlank(1) = picNone2 picBlank(2) = picNone3 picBlank(3) = picNone4 picBlank(4) = picNone5 picBlank(5) = picNone6 picBlank(6) = picNone7 picBlank(7) = picNone8 picBlank(8) = picNone9 picX(0) = picX1 picX(1) = picX2 picX(2) = picX3 picX(3) = picX4 picX(4) = picX5 picX(5) = picX6 picX(6) = picX7 picX(7) = picX8 picX(8) = picX9 picO(0) = picO1 picO(1) = picO2 picO(2) = picO3 picO(3) = picO4 picO(4) = picO5 picO(5) = picO6 picO(6) = picO7 picO(7) = picO8 picO(8) = picO9 I then created a private sub called comp Private Sub comp() Dim random As New Random Dim pictureboxselected As Integer = random.Next(0, 10) End Sub And thats all I got for 1 player game. I don't know what to do next. Help
VIEWS ON THIS POST

78

Posted on:

Wednesday 28th November 2012
View Replies!

homework for vb pennies calculator

I saw someone post something similar, however I don't know that code so I'm not going to use it Option Strict On Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click 'variable dim Dim shtDollars As Integer Dim sngDollars As UShort Dim shtQuarters As Integer Dim sngQuarters As UShort Dim shtDimes As Integer Dim sngDimes As UShort Dim shtNickles As Integer Dim sngNickles As Integer 'constant Const valDollars As Single = 100 Const valQuarters As Single = 25 Const valDimes As Single = 10 Const valNickles As Single = 5 'input data sngDollars = CUShort(txtPennies.Text) 'for Dollars shtDollars = CInt(sngDollars \ 100) sngDollars = CUShort(CUShort(txtPennies.Text) \ 100) lblDollars.Text = Convert.ToString(shtDollars) 'for quarters shtQuarters = CInt(sngQuarters \ 25) sngQuarters = CUShort(CUShort(txtPennies.Text) \ 25) lblQuarters.Text = Convert.ToString(shtQuarters) shtDollars = CInt((CDbl(txtPennies.Text) Mod 25)) 'for dimes shtDimes = CInt(sngDimes \ 10) sngDimes = CUShort(CUShort(txtPennies.Text) \ 10) lblDimes.Text = Convert.ToString(shtDimes) shtDimes = CInt((CDbl(txtPennies.Text) Mod 10)) 'for nickles shtNickles = CInt(sngNickles \ 5) sngNickles = CUShort(CUShort(txtPennies.Text) \ 5) lblNickles.Text = Convert.ToString(shtNickles) shtNickles = CInt((CDbl(txtPennies.Text) Mod 5)) lblNickles.Text = CStr(CInt(((CDbl(txtPennies.Text) Mod 5)))) my nickles is the same as dimes when i hit calulate. i tried using convert.tostring( ) but that doesn't work. any suggestions
VIEWS ON THIS POST

78

Posted on:

Friday 30th November 2012
View Replies!