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

Save off attachment and start SQL stored procedure



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 22nd 08, 03:44 PM posted to microsoft.public.outlook.program_vba
Webtechie
external usenet poster
 
Posts: 2
Default Save off attachment and start SQL stored procedure

Hello,

I have programmed using VBA for Excel, Word and Access before. However,
never Outlook.

1) But I need to check folders for mail from out clients.
2) If I find mail from out clients, I need to save off the attachment in a
certain folder
3) Then I want to kickoff a SQL Server stored procedure

Now having said that, can anyone at least point me in the right direction?

Can you set up a macro to run at intervals throughout the day?
Can you save off the attachments?
And of course, how to execute a SQL Server stored procedure?

Thanks for any and all help in my getting started with this.

Tony
Ads
  #2  
Old December 22nd 08, 08:15 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Save off attachment and start SQL stored procedure

Running a macro at specified times or at intervals is not supported out of
the box. You would need to use a timer to fire at intervals to kick-start
the process. Since VBA code doesn't provide a timer control you would need
to have either VB6 installed and use its timer control or use a Win32 API
timer control. You can find VB6 code for a Win32 API timer at
www.vbaccelerator.com and modify that as needed to work in your VBA code.

You can save attachments from specific items to the file system, there's
code to remove attachments from selected items at
http://www.slovaktech.com/code_sampl...ripAttachments that could be
used as a starter for your code.

How you call a stored procedure in SQL Server depends on how you're
connecting to the SQL server and is out of scope for this newsgroup. You
will need to specify how you're connecting, for example using ADO or
whatever.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Webtechie" wrote in message
news
Hello,

I have programmed using VBA for Excel, Word and Access before. However,
never Outlook.

1) But I need to check folders for mail from out clients.
2) If I find mail from out clients, I need to save off the attachment in
a
certain folder
3) Then I want to kickoff a SQL Server stored procedure

Now having said that, can anyone at least point me in the right direction?

Can you set up a macro to run at intervals throughout the day?
Can you save off the attachments?
And of course, how to execute a SQL Server stored procedure?

Thanks for any and all help in my getting started with this.

Tony


  #3  
Old December 22nd 08, 08:46 PM posted to microsoft.public.outlook.program_vba
Webtechie
external usenet poster
 
Posts: 2
Default Save off attachment and start SQL stored procedure

Ken,

Thanks for your response.

I found code to save off attachments. I just don't know how to execute the
procedure upon arrival on new mail.

I know you can create a rule based on when mail arrives, but I didn't know
if you could run a VBA procedure that way.

I disagree about my question about SQL Server being outside the scope of
this forum.

If I need to run something from Outlook, to me that is in scope!

I wasn't sure if I could use the same ADO recordset commands that I used to
connect EXCEL VBA to SQL Server in Outlook VBA.

Again thanks for your response.


Tony

"Ken Slovak - [MVP - Outlook]" wrote:

Running a macro at specified times or at intervals is not supported out of
the box. You would need to use a timer to fire at intervals to kick-start
the process. Since VBA code doesn't provide a timer control you would need
to have either VB6 installed and use its timer control or use a Win32 API
timer control. You can find VB6 code for a Win32 API timer at
www.vbaccelerator.com and modify that as needed to work in your VBA code.

You can save attachments from specific items to the file system, there's
code to remove attachments from selected items at
http://www.slovaktech.com/code_sampl...ripAttachments that could be
used as a starter for your code.

How you call a stored procedure in SQL Server depends on how you're
connecting to the SQL server and is out of scope for this newsgroup. You
will need to specify how you're connecting, for example using ADO or
whatever.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Webtechie" wrote in message
news
Hello,

I have programmed using VBA for Excel, Word and Access before. However,
never Outlook.

1) But I need to check folders for mail from out clients.
2) If I find mail from out clients, I need to save off the attachment in
a
certain folder
3) Then I want to kickoff a SQL Server stored procedure

Now having said that, can anyone at least point me in the right direction?

Can you set up a macro to run at intervals throughout the day?
Can you save off the attachments?
And of course, how to execute a SQL Server stored procedure?

Thanks for any and all help in my getting started with this.

Tony



  #4  
Old December 22nd 08, 09:47 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Save off attachment and start SQL stored procedure

If you want to execute your code when new items arrive rather than at timed
intervals you can use a script executed from a rule or you can directly
handle either the NewMailEx event or the Inbox.Items.Add event. The script
executed from a rule is a public macro with this signatu

Sub myRuleScriptOrWhateverName(item As MailItem)

For information on the Items.Add event search for "zaphtml" at
www.outlookcode.com and for NewMailEx just search on that there. There are
lots of code samples there for that sort of thing.

Whether it's Outlook or Excel or Word VBA or VB6, if you're using ADOB then
executing stored procedures is identical. Same for any other connection
method you want to use. That's what's out of scope for this group, we don't
delve into the intricacies of SQL Server or other DB work.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Webtechie" wrote in message
...
Ken,

Thanks for your response.

I found code to save off attachments. I just don't know how to execute
the
procedure upon arrival on new mail.

I know you can create a rule based on when mail arrives, but I didn't know
if you could run a VBA procedure that way.

I disagree about my question about SQL Server being outside the scope of
this forum.

If I need to run something from Outlook, to me that is in scope!

I wasn't sure if I could use the same ADO recordset commands that I used
to
connect EXCEL VBA to SQL Server in Outlook VBA.

Again thanks for your response.


Tony


 




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
Stored Email Addresses when you start typing in an email address Kobus Outlook - Using Contacts 2 December 5th 08 02:01 PM
Outlook 2007 Save My Settings Wizard, where's the profile stored? dscrap Outlook - Installation 8 February 13th 08 11:12 PM
Save Attachment via VBA Roger Converse Outlook and VBA 5 January 14th 08 06:16 PM
Calling a Stored Procedure inside mysql Computer Newbie Outlook and VBA 1 March 14th 06 07:48 PM
How do I call a stored procedure inside my sql with a vba script? Computer Newbie Outlook and VBA 1 March 14th 06 08:08 AM


All times are GMT +1. The time now is 08: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.