babru
04-04-2013, 07:20 AM
Hi everybody,
I'm quite new in programming vba for outlook, so I helped myself with some Excel vba code but it doesn't really work out. I am stumped. Please help me.
This is how it's supposed to work:
I have a form in which I insert the data, press ENTER and the code opens a specific email, which is already in the Code.
Here comes the catch:
The Emails are gonna be displayed and not sent (what works surprisingly)
And here is the Code: (It's a bit shortend)
Private Sub OptionButton_Absage_Click()
ComboBox1.Clear
With ComboBox1
.AddItem "Absage auf Initiativbewerbung"
.AddItem "Absage nach Erstgespräch"
.AddItem "Absage nach Zweitgespräch"
.AddItem "Absage nach Gespräch auf Messe"
.AddItem "Absage nach Anzeigenschaltung"
.AddItem "Absage an Patentanwaltskandidaten"
.AddItem "Absage auf Englisch"
End With
End Sub
Private Sub OptionButton_Eingangsbestaetigung_Click()
ComboBox1.Clear
With ComboBox1
.AddItem "Eingangsbestätigung"
.AddItem "Anforderung fehlender Unterlagen allgemein"
.AddItem "Anforderung Abiturzeugnis"
End With
End Sub
Private Sub OptionButton_sonstiges_Click()
ComboBox1.Clear
With ComboBox1
.AddItem "Anschreiben ON HOLD Kandidaten"
.AddItem "Zwischenbescheid an Bewerber"
.AddItem "Nachfassen beim Partner"
End With
End Sub
Private Sub cmd_Enter_Click()
If Me.OptionButton_Frau.Value = True Then
Call email
Unload Me
End If
End Sub
Public Sub Email_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<FONT face=""Trebuchet MS"" size=2> " & _
"Text"
On Error Resume Next
With OutMail
.To = Me.txt_Email.Value
.CC = ""
.BCC = ""
.Subject = "Ihre Bewerbung bei Bird & Bird LLP"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I'm quite new in programming vba for outlook, so I helped myself with some Excel vba code but it doesn't really work out. I am stumped. Please help me.
This is how it's supposed to work:
I have a form in which I insert the data, press ENTER and the code opens a specific email, which is already in the Code.
Here comes the catch:
The Emails are gonna be displayed and not sent (what works surprisingly)
And here is the Code: (It's a bit shortend)
Private Sub OptionButton_Absage_Click()
ComboBox1.Clear
With ComboBox1
.AddItem "Absage auf Initiativbewerbung"
.AddItem "Absage nach Erstgespräch"
.AddItem "Absage nach Zweitgespräch"
.AddItem "Absage nach Gespräch auf Messe"
.AddItem "Absage nach Anzeigenschaltung"
.AddItem "Absage an Patentanwaltskandidaten"
.AddItem "Absage auf Englisch"
End With
End Sub
Private Sub OptionButton_Eingangsbestaetigung_Click()
ComboBox1.Clear
With ComboBox1
.AddItem "Eingangsbestätigung"
.AddItem "Anforderung fehlender Unterlagen allgemein"
.AddItem "Anforderung Abiturzeugnis"
End With
End Sub
Private Sub OptionButton_sonstiges_Click()
ComboBox1.Clear
With ComboBox1
.AddItem "Anschreiben ON HOLD Kandidaten"
.AddItem "Zwischenbescheid an Bewerber"
.AddItem "Nachfassen beim Partner"
End With
End Sub
Private Sub cmd_Enter_Click()
If Me.OptionButton_Frau.Value = True Then
Call email
Unload Me
End If
End Sub
Public Sub Email_Outlook()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<FONT face=""Trebuchet MS"" size=2> " & _
"Text"
On Error Resume Next
With OutMail
.To = Me.txt_Email.Value
.CC = ""
.BCC = ""
.Subject = "Ihre Bewerbung bei Bird & Bird LLP"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub