?
Solved

Renaming E-mail attachment in outlook or thunderbird

Posted on 2008-11-12
10
Medium Priority
?
429 Views
Last Modified: 2013-11-27
Hi Guys,

Here's my problem. I have a standalone computer and a server. both run the same database. On the server the SQL database in synchronized with a program called DBsinc to the ms access database.
I also have changes on my computer and need some way to update the database on the server and update my own database from the server database. I know this is not the way I should approach this problem but it looks like it's my only option for the moment.
Due to security reasons where I work it is not possible to go around this using FTP. That means my only way out is by using email. I have written some code to automatically send an email and attached a table with the necessary update data. Now I need some way to get the attachment out of the email with VBA. Im currently using Thunderbird witch has the option to store attachments in a different folder on the computer. Unfortunately it refuses to do so.

What I need to know is how to isolate a attachment from an email and save it in a specified folder. Using thunderbird, outlook or any other program I can easily download is just fine.
0
Comment
Question by:dprager
  • 6
  • 4
10 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22947851
As an exampole see her for outlook.

Any clarification or tweaking required then of course ask.

Chris
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 2000 total points
ID: 22947853
0
 
LVL 1

Author Comment

by:dprager
ID: 22948431
Thanx,

The code you gave me Works perfect. There are just a few little things that need to alter.

The code only removes the attachments of the selected emails and puts them in the specified folder entered in the input box. Im lazy so I dont want to open Outlook explorer and select the specified email.

Is there a way in the code to select all of the emails listed in inbox and replace all of the attachments of the email messages there? I think I should alter the code listed below but I dont really know how.

Second of all I get a message that program is trying to alter my emails ( can I get rid of this annoying message ? )

On Error Resume Next
   
    'work on selected items
    Set myOlExp = myOlApp.ActiveExplorer
    Set myOlSel = myOlExp.Selection ( needs to be all emails  in inbox in this line)
   
    'for all items do...
    For Each myItem In myOlSel
   
        'point on attachments
        Set myAttachments = myItem.Attachments
       
        'if there are some...
        If myAttachments.Count > 0 Then
       
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22948715
1. To select all items:
change
    Set myOlExp = myOlApp.ActiveExplorer
    Set myOlSel = myOlExp.Selection ( needs to be all emails  in inbox in this line)
     
    'for all items do...
    For Each myItem In myOlSel
to
    Set myOlExp = myOlApp.ActiveExplorer
    Set myOlSel = myOlExp..getnamespace("MAPI").getdefaultfolder(6)
   
    'for all items do...
    For Each myItem In myOlSel.items

Ought to do it.

2. Pesky message, assuming 2003 or earlier then personally I find  mapilab to be ideal but see:
You can modify your code to use redemption:
http://www.dimastr.com/redemption/

You can use an outlook add-in i.e:
http://www.mapilab.com/outlook/security

Or finally you can use clickyes
http://www.contextmagic.com/

ANy help?

Chris

 
0
 
LVL 1

Author Comment

by:dprager
ID: 22949334
Thanx again,

But don't have it working yet. The counter stays empty in some strange way. Could you please take a look at the attached screenshot.

< i >  is empty so the VB code gets caught in an infinite loop and the program crashes.



0
 
LVL 1

Author Comment

by:dprager
ID: 22949561
Thanx again,

But don't have it working yet. The counter stays empty in some strange way. Could you please take a look at the attached screenshot.

< i >  is empty so the VB code gets caught in an infinite loop and the program crashes.




SCR.JPG
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22949814
Looks alright albeit I don't have 2000.

If you set a watch on i, and step through the delete block how does it look on entry and on each step?

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22949832
The other thing is use the mechanism:

for i = myattachments.count to 1 step -1
     save it
     delete it
next

Chris
0
 
LVL 1

Author Comment

by:dprager
ID: 22992189
Thanx, it took me a while to get corking the way I wanted it to but it works great now !!

Thanx Defenitly worth full points !!
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22992291
Glad to be of some help and thank you for the grade.

Chris
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question