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

VBA Script to save emails to my hard disk



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 17th 07, 06:30 PM posted to microsoft.public.outlook.program_vba
SteveH
external usenet poster
 
Posts: 12
Default VBA Script to save emails to my hard disk

I have recently moved jobs, and at my old place we had a button in oulook
running a vba macro to file emails in msg to the servers hard disk.
Unfortunatly I was unable to take he script with me.
On the local HD there were txt files containing the following:-
Year.txt - containing a list of years available ie 00, 05, 06, 07 etc
07.txt - containing all the jobs in that year ie 07001 - job 1.
You clicked on the email to be filled, either in the Inbox or SentMail, then
you click on the button for the macro and the script runs. It asks you for
the job year (listed in year.txt) and then you pick the job (listed in
07.txt) and the the email is filed with a date code on the servers HD in a
suitable directory, ie ..../07/07001/xxx.msg.

Can you help with writing the script to do the above, or if not point me in
the direction of some suitable help. Unfortunatly my knowledge of VBA is
limited, I am more of an end user.

Thanks in advance for all your help

Steve
Ads
  #2  
Old August 20th 07, 03:50 AM posted to microsoft.public.outlook.program_vba
D.Lee
external usenet poster
 
Posts: 10
Default VBA Script to save emails to my hard disk

What version of Outlook do you have, Steve?
--
David Lee - MVP Outlook

  #3  
Old August 20th 07, 09:56 AM posted to microsoft.public.outlook.program_vba
SteveH
external usenet poster
 
Posts: 12
Default VBA Script to save emails to my hard disk

Currently Running Outlook 2003 on XP based PCs

Steve


"D.Lee" wrote:

What version of Outlook do you have, Steve?
--
David Lee - MVP Outlook

  #4  
Old August 20th 07, 06:28 PM posted to microsoft.public.outlook.program_vba
D.Lee
external usenet poster
 
Posts: 10
Default VBA Script to save emails to my hard disk

Ok, give this a try. This solution comes in two parts, an Outlook userform
and a small macro that launches it. follow this link
(http://www.mindspring.com/~d_lee/frmSave2Disk.zip) to download the userform.
Download the file, it's a zip file, then follow these instructions to import
it.

1. Unzip the two files in the zip.
2. Open Outlook, or switch to it if it's already open.
3. Open the VB Editor.
4. Click File-Import File, select the .frm file and click Open.

Now, add the macro below by following these instructions.

1. Start Outlook.
2. Click Tools-Macro-Visual Basic Editor.
3. If not already expanded, expand Modules and click on Module1.
4. Copy the code below and paste it into the right-hand pane of the VB
Editor.
5. Edit the form code as needed. I placed comments where things can/need
to be changed.
6. Click the diskette icon on the toolbar to save the changes.
7. Close the VB Editor.
8. Click Tools-Macro-Security.
9. Change the Security Level setting to Medium.
10. Create a button to run the macro. If you need instructions on how to do
that, then let me know and I'll post them.

Select one or more messages from any folder and click the button that runs
the macro. It will display a dialog-box allowing you to choose the year and
a job from that year. Clicking Save will save all the selected messages to a
folder associated with the selected year and job. Clicking Cancel exits
without saving anything. The code behind the form assumes a folder structure
like this:

ROOT_FOLDER
Year1
Job1
Job2
Year2
Job1
Job2
Year3
Job1
Job2

I wrote and tested this on a system with Outlook 2003 and it worked
perfectly. The code could be improved on by adding checks to see if the
necessary folders exist and optionally creating them if they don't, fixing
the message subject to remove illegal characters before saving, etc.

Sub SaveMessageToDisk()
Dim objForm As New frmSave2Disk
objForm.Show
Set objForm = Nothing
End Sub

--
David Lee - MVP Outlook

  #5  
Old August 21st 07, 02:41 PM posted to microsoft.public.outlook.program_vba
mark
external usenet poster
 
Posts: 19
Default VBA Script to save emails to my hard disk

Link to the file is not up :-(

"D.Lee" wrote in message
...
Ok, give this a try. This solution comes in two parts, an Outlook
userform
and a small macro that launches it. follow this link
(http://www.mindspring.com/~d_lee/frmSave2Disk.zip) to download the
userform.
Download the file, it's a zip file, then follow these instructions to
import
it.

1. Unzip the two files in the zip.
2. Open Outlook, or switch to it if it's already open.
3. Open the VB Editor.
4. Click File-Import File, select the .frm file and click Open.

Now, add the macro below by following these instructions.

1. Start Outlook.
2. Click Tools-Macro-Visual Basic Editor.
3. If not already expanded, expand Modules and click on Module1.
4. Copy the code below and paste it into the right-hand pane of the VB
Editor.
5. Edit the form code as needed. I placed comments where things can/need
to be changed.
6. Click the diskette icon on the toolbar to save the changes.
7. Close the VB Editor.
8. Click Tools-Macro-Security.
9. Change the Security Level setting to Medium.
10. Create a button to run the macro. If you need instructions on how to
do
that, then let me know and I'll post them.

Select one or more messages from any folder and click the button that runs
the macro. It will display a dialog-box allowing you to choose the year
and
a job from that year. Clicking Save will save all the selected messages
to a
folder associated with the selected year and job. Clicking Cancel exits
without saving anything. The code behind the form assumes a folder
structure
like this:

ROOT_FOLDER
Year1
Job1
Job2
Year2
Job1
Job2
Year3
Job1
Job2

I wrote and tested this on a system with Outlook 2003 and it worked
perfectly. The code could be improved on by adding checks to see if the
necessary folders exist and optionally creating them if they don't, fixing
the message subject to remove illegal characters before saving, etc.

Sub SaveMessageToDisk()
Dim objForm As New frmSave2Disk
objForm.Show
Set objForm = Nothing
End Sub

--
David Lee - MVP Outlook



  #6  
Old August 22nd 07, 12:46 AM posted to microsoft.public.outlook.program_vba
D.Lee
external usenet poster
 
Posts: 10
Default VBA Script to save emails to my hard disk

Apparently the filename is case sensitive. Try this:
http://www.mindspring.com/~d_lee/frmSave2Disk.ZIP
--
David Lee - MVP Outlook


"Mark" wrote:

Link to the file is not up :-(


 




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
I want to relocate the Inbox to an other hard disk than C Miki S Outlook - Installation 1 March 29th 07 01:01 AM
Restoring contacts after hard disk crash Peter Outlook - Using Contacts 1 March 10th 07 02:58 AM
hard disk moved; pst corrupted stratoboom Outlook - General Queries 0 August 15th 06 02:03 PM
Copying over account from hard disk backup Jon_Lowes Outlook - Installation 1 April 5th 06 05:42 PM
How do I Run Outlook and keep it on the hard disk Mike Outlook - General Queries 3 February 20th 06 07:06 PM


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