Urgent: macro attachment fix - 1) save to other than "C:\", 2) saving more than for 1 msg.

  • Thread starter Thread starter Dylan56
  • Start date Start date
D

Dylan56

I tried that macro outlined below and it didn't work in two ways:

Firstly, I need the files to be saved in an alternate folder
outside of the root. It just isn't wise to be saving files I will
move and/or delete at a later time within the root folder. But all
trials made by changing the pathname in the macro to anything other
than "c:\", even when using an 8.3 filenaming format, didn't work.

Then, no matter how many msgs selected, it only saved the
attachment of the first msg in the selection.

How can I fix the two issues, pls?

This is urgent, pls!
 
I tried that macro outlined below and it didn't work in two ways:

Firstly, I need the files to be saved in an alternate folder
outside of the root. It just isn't wise to be saving files I will
move and/or delete at a later time within the root folder. But all
trials made by changing the pathname in the macro to anything other
than "c:\", even when using an 8.3 filenaming format, didn't work.

Then, no matter how many msgs selected, it only saved the
attachment of the first msg in the selection.

How can I fix the two issues, pls?

This is urgent, pls!

Got the solution in a general help group. Here's a macro that now
works:
**********************************************************************************************************
Sub SaveAttachment()
Dim objCurrentItem As Outlook.MailItem
Dim colAttachments As Outlook.Attachments
Dim objAttachment As Outlook.Attachment

Set objCurrentItem = Application.ActiveInspector.CurrentItem
Set colAttachments = objCurrentItem.Attachments
Set strFolderpath = CreateObject("WScript.Shell")

For Each objAttachment In colAttachments
objAttachment.SaveAsFile ("C:\WINDOWS\Desktop\YAHOOgroups\Challenge
results - others\" & objAttachment.FileName)
Next

Set objAttachment = Nothing
Set colAttachments = Nothing
Set objCurrentItem = Nothing

End Sub
**********************************************************************************************************

The changes were minor, removing the line that has the msg close after
the macro is run. And the 2nd problem was the pathname, turns out the
culprit was a minor one (as is often the case), there was a missing
"\" at the end of the path!

Go figure!

Macro is now on the toolbar with an icon. End of problems to great
degree. I don't think I'll be able to fix this better than this. The
ideal would be to somehow fix O2K's inability to save the embedded
image directly to the original format, just like you would if it was
an attachment, but this is definitely good and usable.

:oD
 
Back
Top