Habe in Excel ein Datenbank:
1.Spalte- jobname
2.Spalte -emailadresse von Bearbeiter
Das VBA-Programm muss jobname aussuchen und die e-mailadresse in das Formularfeld "To" einfügen
Kann mir jemand helfen?
Private Function UserName As String
Dim enc As Text.Encoding
enc = Text.Encoding.Unicode
Dim sr As New IO.StreamReader(" 'Hier ist die Excel-Tabelle zu finden")
Dim line As String
Dim JobName As String
JobName = triggerEvent.RootEvent.Job.Name
Do 'Ab hier happert's bei mir: Die E-mail Adresse wird nicht in das Formularfeld "To" eingefügt
line = sr.ReadLine()
If Microsoft.VisualBasic.InStr(line, JobName) > 0 Then
UserName = JobName
Else
UserName = Microsoft.VisualBasic.Split(line,Microsoft.VisualBasic.vbTab)(2) + _
" " + _
Microsoft.VisualBasic.Split(line,Microsoft.VisualBasic.vbTab)(1) + _
" (" + _
UserName + _
")"
End If
Loop
sr.Close()
Return UserName
End Function