Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2009, 04:19 AM
Registered User
 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default get perticular data from outlook mail into excel using VBA

Everyday I am receiving hundreds of mail containing header data and data about active users and concurrent users. I need to extract header information,active user and concurrent user data into excel from all mails. The data should append. For this I want a macro which will do this task.
Note: I kept all these mail into one folder. Plese see example of data
********Header information*******
ABC
PQRSTUVDF
123456
********End of Header information*******
---------------
--------------
----------------
Active Users 300
-------------------------
------------------------
Concurrent Users 10
----------------------------
Please help me!!! Thanks in advance....
 
Old January 23rd, 2009, 04:50 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Is it a Text File?

If it is a Text file you can read the entire contents of the file (http://vbadud.blogspot.com/2007/06/v...h-leading.html) and can filter the data through regular expressions

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old January 23rd, 2009, 04:53 AM
Registered User
 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

its not a text file I want to read the data from mail only
 
Old January 23rd, 2009, 05:05 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

if it is outlook you can check at www.outlookcode.com . IT has lots of code snippets

Here is the simple VBA code to iterate the mails in draft folder that can give you some hint


Sub Check_Drafts_Folder()

Dim oNS As Outlook.NameSpace
Dim oFld As Outlook.Folder
Dim oItems As Outlook.Items

On Error GoTo OL_Error

Set oNS = Application.GetNamespace("MAPI")


Set oFld = oNS.GetDefaultFolder(olFolderDrafts)

Set oItems = oFld.Items

If oItems.Count <> 0 Then
MsgBox "There are some messages in the draft"
End If

Exit Sub
OL_Error:
MsgBox Err.Description
Err.Clear
End Sub
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips &amp; Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA in excel and outlook dlindamood2000 Excel VBA 19 December 7th, 2006 10:16 AM
E-mail using VBA and Outlook cc16 Access VBA 6 December 4th, 2006 11:07 AM
Receiving mail with Outlook 2000 VBA spotts-71 All Other Wrox Books 3 August 24th, 2004 10:41 AM
Receiving mail with Outlook 2000 VBA spotts-71 Pro VB 6 7 July 17th, 2003 03:04 PM
Outlook 2000 VBA - Receive mail... spotts-71 VB How-To 2 July 17th, 2003 02:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.