Recording macros in Microsoft Outlook 2000

G

Guest

Hello,
I am a bit familiar with VBA in Word 2000, but not with VBA in Microsoft
Outlook 2000.

In Word I learned to understand VBA by recording macro's and analyze them,
but I can't record macro's in Micorsoft Outlook, so I have no idea how to
write a macro.

I would like to have a program/macro that can save an attachment in a
message (e.g. txt or jpg etc) from a folder (e.g. downloads etc.) to another
folder somewhere on my hard disk, and then delete the original message.

I guess such a macro must be rather easy, but I have no clue where to start
and how to continue writing that macro.

Is there any one who can help me?

Thanks in advance
Hans van der Meulen
 
N

Neil

I found this code works OK for the saving of attachments -
Substitute your job number/prefix and drive/folder defaults as need be.
I am not expert coder - there might be more elegant ways to do it!
I'm sure the deleting of the 'item' afterwards will be easy to code.
Neil

Dim myolApp As Object
Dim myMessageItem As Object
Dim myAttachmentItems As Object
Dim myJobnumber As String
Dim MyDrive As String
Dim Title As String

Title = "Whizzomatic System"
Set myolApp = CreateObject("Outlook.Application")
Set myMessageItem = myolApp.ActiveInspector.CurrentItem
Set myAttachmentItems = myMessageItem.Attachments

myJobnumber = InputBox("Job Number prefix?", Title, "99999")
If myJobnumber = "" Then GoTo Getout
MyDrive = InputBox("Save on which drive?", Title, "P:\")
If MyDrive = "" Then GoTo Getout

For Each myAttachmentItems In myAttachmentItems
myAttachmentItems.SaveAsFile MyDrive & myJobnumber & "-" &
myAttachmentItems.DisplayName
Next

Getout:
Set myolApp = Nothing
Set myMessageItem = Nothing
Set myAttachmentItems = Nothing
 
W

Woody

myMessageItem.delete

Woody
I am not responsible for anything you may see with my name attached to
it, i think.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top