Saving Attachments - SavaAsFile

Saving Attachments - SavaAsFile

Post by Joe Chris » Sun, 28 Apr 2002 04:53:12



Hello,

I was wondering if anyone new of a modification to the below script
that would allow the script to not simply overwrite an already saved
attachment if the names are the same, but simply add an addition to
the name (maybe).

Here's what I got so far:
---------------

Sub ReportSave()
    Dim oApp As Application
    Dim oNS As NameSpace
    Dim oMsg As Object
    Dim oAttachments As Outlook.Attachments
    Dim myString

    Set oApp = New Outlook.Application
    Set oNS = oApp.GetNamespace("MAPI")
    Set myFolder = oNS.GetDefaultFolder(olFolderInbox)
    Set oFolder = myFolder.Folders("Change Memos")

    For Each oMsg In oFolder.Items
        With oMsg
                myString = Replace(oMsg, "/", "-")
                oMsg.Attachments.Item(1).SaveAsFile "C:\reports\in\"
                & myString & ".html"
        End With
    Next
End Sub

 
 
 

Saving Attachments - SavaAsFile

Post by solebiopai » Wed, 29 May 2002 00:08:38


You could try to add the hour to the name of file when
you record it.

Heurjour = Format(Now, "hhmmss")

Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myAttachments = myItem.Attachments
myAttachments.Item(1).SaveAsFile "C:\reports\in\" &
myString & myAttachments.Item(1).DisplayName & "_" &
Heurjour

we have a question : how can we do to save several
atached files of the same message?

Quote:>-----Original Message-----
>Hello,

>I was wondering if anyone new of a modification to the
below script
>that would allow the script to not simply overwrite an
already saved
>attachment if the names are the same, but simply add an
addition to
>the name (maybe).

>Here's what I got so far:
>---------------
>Sub ReportSave()
>    Dim oApp As Application
>    Dim oNS As NameSpace
>    Dim oMsg As Object
>    Dim oAttachments As Outlook.Attachments
>    Dim myString

>    Set oApp = New Outlook.Application
>    Set oNS = oApp.GetNamespace("MAPI")
>    Set myFolder = oNS.GetDefaultFolder(olFolderInbox)
>    Set oFolder = myFolder.Folders("Change Memos")

>    For Each oMsg In oFolder.Items
>        With oMsg
>                myString = Replace(oMsg, "/", "-")
>                oMsg.Attachments.Item

(1).SaveAsFile "C:\reports\in\"

- Show quoted text -

Quote:>                & myString & ".html"
>        End With
>    Next
>End Sub
>.


 
 
 

1. can't open attachment, but I can save attachment

When I try to open an attachment I can't, but I can save
it.
I got the following error message:

The document name or path is not valid.
Try one or more of the following:
Check the path to make sure it was typed correctly
On the file nenu, click Open. Seach for the file using
this dialog box.
(C:\...\Y5MI9SE7\CVasdf.doc)

Thanks
JC

2. dups records

3. Saving Attachment "Save In" error Outlook XP

4. printing labels

5. Save/Save Attachments Grayed Out

6. rename a category

7. REPOST Saving Attachment "Save In" error Outlook XP

8. Access Accounting

9. Saving Attachment "Save In" error Outlook XP

10. OE incorrectly saves "Save attachment path" after latest updates

11. File save attachments command not remembering save designation

12. Word X saves automatic without asking don't save - save - cancel

13. Restoring the Open / Save options for attachments