Grab info from attachment and put into SQL db

Status
Not open for further replies.
M

manared

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.
 
E

EricLegault

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 here:

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 - , MCDBA, MCTS (SharePoint programming, etc.)

"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.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C How do I grab a field property (like .value) so I can modify it via OL code? Outlook VBA and Custom Forms 4
S Using copy paste to grab email addresses from the TO: address fiel Using Outlook 14
J Outlook 365 Outlook 2016/365 Contacts Lose Info when Favorited to the To-Do Bar Using Outlook 2
M How to setup outlook after importing old account information - Entering email account info creates with "(1)" after the account! Using Outlook 1
W Outlook WAS facebook but there is no info for old accounts Using Outlook 0
Randy Redekopp How To Merge Contact Info to Email Custom Form Template Using Outlook 2
B Calendar shows too much info by default Using Outlook 0
G Message template / custom forms and VBA Help needed - inserting info into table Outlook VBA and Custom Forms 3
R Can BCM monitor and select specific emails and use content info to update the client's record? BCM (Business Contact Manager) 1
Digitally Hip Outlook 2010 (32) and Exchange 2010 (sp3) sender info not displaying in Outlook Using Outlook 1
K Reducing data input, how to auto-fill Account form info into Contact form BCM (Business Contact Manager) 0
S Is it possible to backup Outlook.com/Outlook 2013 Email & Calendar info? Using Outlook.com accounts in Outlook 3
T doesn't show up previous info (email, contacts and tasks)after windows up date Using Outlook 0
D User Defined Info Gone Using Outlook 1
H Viewing of Calendar info Exchange Server Administration 0
dolke Strange Outlook behavior when receiving emails. More info in the content... Using Outlook 7
B Can I recover info from size limited IMAP file (Outlook 2003) Using Outlook 3
D Extracting Location info from All Day Event in mailboxes into webpage Exchange Server Administration 3
J saving contact info in specific address books Using Outlook 0
T Completely wipe all Outlook-related info for reinstall Using Outlook 1
M Outlook Macro to get Exchange Info from Mail Outlook VBA and Custom Forms 25
K Outlook admin vs individual access (VBA pulling info) Outlook VBA and Custom Forms 1
D Re: Can contact info be transferred to Word document as in E-mail BCM (Business Contact Manager) 1
A Upgrade to 2007, lost 'Accounts' info BCM (Business Contact Manager) 1
M Check Profile info Outlook VBA and Custom Forms 1
T Trickle down info from updated Accounts to Contacts BCM (Business Contact Manager) 1
R find sender info Outlook VBA and Custom Forms 5
A How to get shared calendar's owner info Outlook VBA and Custom Forms 3
kkqq1122 How would I add Search for attachment name Outlook VBA and Custom Forms 3
Owl Export Outlook PDF Attachment as JPG? Outlook VBA and Custom Forms 3
Timmon Remove just one attachment before AutoForward Outlook VBA and Custom Forms 0
P File Picker for attachment Outlook VBA and Custom Forms 0
D Forwarding email based on the attachment file type and specific text found on the attachment file name Outlook VBA and Custom Forms 1
N File Picker for attachment Outlook VBA and Custom Forms 2
G print attachment straight away; working script edit not working Outlook VBA and Custom Forms 0
G Save attachment run a script rule Outlook VBA and Custom Forms 0
M Autoforward just attachment OR just body. Outlook VBA and Custom Forms 0
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
T vba extract data from msg file as attachment file of mail message Outlook VBA and Custom Forms 1
K Outlook Office 365 VBA download attachment Outlook VBA and Custom Forms 2
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
S save attachment with date & time mentioned inside the file Outlook VBA and Custom Forms 0
O VBA Outlook Message Attachment - Array Index Out of Bounds Outlook VBA and Custom Forms 0
A Edit attachment Save and Reply Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
B Outlook 2010 Opening Mail Attachment Using Outlook 2
A Warning When Opening attachment Using Outlook 7
R Limiting length of saved attachment in VBA Outlook VBA and Custom Forms 2
F Script for zip file attachment Outlook VBA and Custom Forms 1
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1

Similar threads

Top