Hallo Leute,
ich habe in outlook noch nie etwas geschrieben (habe nur Erfahrung in Excel VBA),
jetzt möchte ich aber das Outlook ungelesene Mails abcheckt auf bestimmte Werte,
wenn alles passt soll der Anhang in einem Ordner gespeichert werden.
Parameter die stimmen müssen sind:
-Sender der Email (if false then Exit)
-Tag und Monats Zeitraum (if false then Exit)
-hat eine PDF als Anhang (if false then Exit)
Ich habe mir jetzt erstmal die ersten schnellen Ideen aufgeschrieben,
aber weiß eben nicht ob es für solche Sachen bereits vordefinierte/implementierte
Funktionen usw. in Outlook VBA gibt.
Habt ihr Vorschläge, Ideen, oder sonstiges für mich?
Hier mein bisschen "pseudo" Code:
ich habe in outlook noch nie etwas geschrieben (habe nur Erfahrung in Excel VBA),
jetzt möchte ich aber das Outlook ungelesene Mails abcheckt auf bestimmte Werte,
wenn alles passt soll der Anhang in einem Ordner gespeichert werden.
Parameter die stimmen müssen sind:
-Sender der Email (if false then Exit)
-Tag und Monats Zeitraum (if false then Exit)
-hat eine PDF als Anhang (if false then Exit)
Ich habe mir jetzt erstmal die ersten schnellen Ideen aufgeschrieben,
aber weiß eben nicht ob es für solche Sachen bereits vordefinierte/implementierte
Funktionen usw. in Outlook VBA gibt.
Habt ihr Vorschläge, Ideen, oder sonstiges für mich?
Hier mein bisschen "pseudo" Code:
Visual Basic-Quellcode
- Option Explicit
- Sub Main()
- '//Dim fso As Object :Set fso = CreateObject("Outlook.Application")
- Dim oOut As Object :Set oOut = "Current outlook sesh...if not then new one.." '//Bool Funct wieder
- Dim oMail As Object
- Dim curDate As Date
- '//Datum der momentanen E-Mail
- curDate = oMail.Date
- '/* check a bunch of bool Functions....
- ' ...some more
- ' ...almost there
- '/ any mail valid?
- '//Then grab the attatchment from here on!
- '//Code..... to get attatchment and save it in user folder xy
- End Sub
- Private Function OutlookAppIsRunning() As Boolean
- End Function
- 'check the name of the sender
- '=================================================
- 'Bool Function to see if the name of sender is allowed
- Private Function CorrectMailName(ByVal senderName As String) As Boolean
- If senderName = "some Mail address..." Then CorrectMailName = True '//Email noch einfügen!
- End Function
- '1 Check if the Date is in a certain field
- '2 Check if the Day and the Month are in field
- '=================================================
- 'Check if day and month are OK
- Private Function curDateIsCorrect(ByVal DateToCheck As Date) As short
- if dayIsAllowed(DateToCheck) And _
- if monthIsAllowed(DateToCheck) Then curDateIsCorrect = True
- End Function
- 'Bool Function for Day
- Private Function dayIsAllowed(ByVal DayToCheck) As Boolean
- Dim temp As Byte
- temp = CByte(Format(DateToCheck, "dd")
- Select Case temp
- Case 1 to 5
- dayIsAllowed = True
- Case 26 to 31
- dayIsAllowed = True
- End Select
- End Function
- '//Bool Function ffor Month
- Private Function monthIsAllowed(ByVal MonthToCheck) As Boolean
- Dim temp As Byte
- Dim curMonth As Byte
- Dim diff As Byte
- curMonth = CByte(Date, "mm")
- temp = CByte(Format(DateToCheck, "mm")
- diff = curMonth - temp
- Select Case diff
- Case 1
- monthIsAllowed = True
- Case 0
- monthIsAllowed = True
- End Select
- End Function
- 'See if there is some Data to get
- '=================================================
- '//Bool for checking if the Mail has an Attachment
- Private Function MailHasAttachment() As Boolean
- '//some Code
- End Function