Als aboluter VBA Dau bin ich auf der Suche nach Unterstützung für ein kleines (ich denk mir mal es kann für jemand der Verständnis von der Materie hat keine Hexerei sein) VBA Script für folgende Aufgabenstellung. Ich erhalte mehrmals täglich von einem besteimmten Absender Mails die ich als *.msg auf einem Netzlaufwerk speichern möchte. Der Datei Name soll aus dem Betreff bezogen werden. Kann mir hier jemand ein paar Tips geben?
Vielen Dank Kidjo
1 Antwort
1 Antwort anzeigen (von insgesamt 1)
Antwort 1 Teqischrieb am
das habe ich gefunden (vielleicht hilft es): Hier mal ein Vorschlag:
Dim WithEvents colInspectors As Outlook.Inspectors
Private Sub Application_Startup()
Set colInspectors = Application.Inspectors
End Sub
Private Sub colInspectors_NewInspector(ByVal Inspector As Inspector)
\' your code to work with Inspector goes here
\' if you want to work with the actual item that\'s opened,
\' use this:
\'Dim objItem As Object
\'Set objItem = Inspector.CurrentItem
Dim myolApp As Object
Dim myMessageItem As Object
Dim myAttachmentItems As Object
Dim myJobnumber As String
Dim MyDrive As String
Dim Title As String
Set myolApp = CreateObject(\"Outlook.Application\")
Set myMessageItem = Inspector.CurrentItem
Set myAttachmentItems = myMessageItem.Attachments
With myMessageItem
\'basic info about message
Debug.Print .To
Debug.Print .CC
Debug.Print .Subject
Debug.Print .Body
If .UnRead Then
Debug.Print \"Message has not been read\"
Else
Debug.Print \"Message has been read\"
End If
myJobnumber = InputBox(\"Title prefix?\", Title, \"99999\")
If myJobnumber = \"\" Then GoTo Getout
MyDrive = InputBox(\"What is the case number\", Title, \"Case Number\")
MyDrive = \"C:\\\" & MyDrive & \"\\1\\\"
If MyDrive = \"\" Then
Dim AbortRetryIgnore
AbortRetryIgnore = MsgBox(\"Not a valid case number - Retry or Cancel?\", vbRetryCancel + vbCritical)
Select Case AbortRetryIgnore
Case vbRetry
MyDrive = InputBox(\"What is the case number\", Title, \"Case Number\")
Case vbCancel
GoTo Getout
End Select
End If
If Dir(MyDrive, vbDirectory) = \"\" Then
MsgBox \"No such Customer!\"
GoTo Getout
End If
.SaveAsFile MyDrive & myJobnumber & \"-\" & myMessageItem.DisplayName
End With
DoEvents
\'start of attachment process
For Each myMessageItem In myAttachmentItems
myJobnumber = InputBox(\"Title prefix?\", Title, \"99999\")
If myJobnumber = \"\" Then GoTo Getout
MyDrive = InputBox(\"What is the case number\", Title, \"Case Number\")
MyDrive = \"C:\\\" & MyDrive & \"\\1\\\"
If MyDrive = \"\" Then
\'Dim AbortRetryIgnore
AbortRetryIgnore = MsgBox(\"Not a valid case number - Retry or Cancel?\", vbRetryCancel + vbCritical)
Select Case AbortRetryIgnore
Case vbRetry
MyDrive = InputBox(\"What is the case number\", Title, \"Case Number\")
Case vbCancel
GoTo Getout
End Select
\'If Dir(MyDrive, vbDirectory) = \"\" Then
\'MkDir MyDrive
End If
\'myMessageItem.SaveAsFile MyDrive & myJobnumber & \"-\" & myMessageItem.DisplayName
If Dir(MyDrive, vbDirectory) = \"\" Then
MsgBox \"No such Customer!\"
GoTo Getout
End If
myMessageItem.SaveAsFile MyDrive & myJobnumber & \"-\" & myMessageItem.DisplayName
Next
Getout:
Set myolApp = Nothing
Set myMessageItem = Nothing
Set myAttachmentItems = Nothing
End Sub
1 Antwort anzeigen (von insgesamt 1)
Sie müssen angemeldet sein, um zu diesem Thema eine Antwort verfassen zu können.
Auf dieser Seite werden Cookies verwendet. Wir können damit die Seitennutzung auswerten, um nutzungsbasiert redaktionelle Inhalte und Werbung anzuzeigen. Das ist für uns wichtig, denn unser Angebot finanziert sich über Werbung. Indem Sie die Seite nutzen, stimmen Sie der Cookie-Nutzung zu. OkMehr dazu
Cookies
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.