A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Grab info from attachment and put into SQL db



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 1st 09, 08:07 PM posted to microsoft.public.outlook.program_vba
manared
external usenet poster
 
Posts: 1
Default Grab info from attachment and put into SQL db

I'm very new to VBA, but have been programming with vb.net for several years
now. What I would like to do is grab an attachment (excel), suck out all the
information in that excel file and enter it into a SQL database. I have no
clue how to do that using VBA and Outlook. I'd love to be able to have this
done automatically when the email comes in, but if the user has to click a
button to go through the inbox to grab the specific emails/attachments,
that's alright. I just don't know how to get that attachment info to the
database.
Ads
  #2  
Old September 2nd 09, 03:29 AM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Grab info from attachment and put into SQL db

There's no quick and easy answer, but I can guide you down the path.

First, this is a must read:

How to process incoming messages in Microsoft Outlook:
http://www.outlook-code.com/article.aspx?id=62

The next step is to become familiar with the Outlook Object Model:

http://msdn.microsoft.com/en-us/library/bb208225.aspx

Then basically you need to get a handle to the MailItem you want, and grab
the Attachment object you want from MailItem.Attachments collection and call
the Attachments.SaveAsFile method.

See the example he

http://msdn.microsoft.com/en-us/library/bb219926.aspx

As for exporting the contents of the Excel attachment to SQL - that's not a
question for an Outlook forum! You're looking at ODBC/OLE DB/ADO.NET and the
Excel Object Model for that scenario.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"manared" wrote:

I'm very new to VBA, but have been programming with vb.net for several years
now. What I would like to do is grab an attachment (excel), suck out all the
information in that excel file and enter it into a SQL database. I have no
clue how to do that using VBA and Outlook. I'd love to be able to have this
done automatically when the email comes in, but if the user has to click a
button to go through the inbox to grab the specific emails/attachments,
that's alright. I just don't know how to get that attachment info to the
database.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab URL and put in a mail (Outlook 2003) jh[_3_] Outlook - General Queries 4 March 14th 09 03:42 AM
Grab URL and put in a mail (Outlook 2003) Indstillinger No Name Outlook and VBA 0 March 9th 09 09:09 AM
Is this possible (Grab Outlook data from MS Access)? Dorian Outlook and VBA 2 February 26th 09 02:53 PM
Grab emails as they are sent Humphrey Outlook and VBA 2 February 26th 09 02:46 PM
Grab when user saves a form. Flemming Outlook and VBA 1 May 11th 06 01:49 PM


All times are GMT +1. The time now is 09:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.