AW: der ganze code
27.09.2011 11:37:30
amintire
Also so ist der ganze Code den ich in der UserForm habe:
Option Explicit
Dim arrFotos
Dim arrfotos1
Dim arrfotos2
Dim arrfotos3
Dim arrfotos4
Private Sub SpinButton1_Change()
Image1.Picture = LoadPicture(arrFotos(SpinButton1))
Label1 = SpinButton1 + 1
TextBox1 = arrFotos(SpinButton1)
Repaint
Dim vartmp As Variant
With Tabelle13 'Mitarbeiter
vartmp = Application.Match(TextBox1.Text, .Range("A:A"), 0)
If Not IsError(vartmp) Then
Me.Tag = vartmp
TextBox2.Text = .Cells(vartmp, 2).Value
Else
Me.Tag = ""
TextBox2.Text = ""
End If
End With
End Sub
Private Sub SpinButton2_Change()
Image2.Picture = LoadPicture(arrfotos1(SpinButton2))
Label4 = SpinButton2 + 1
TextBox5 = arrfotos1(SpinButton2)
Repaint
Dim vartmp1 As Variant
With Tabelle14 'Mitarbeiter
vartmp1 = Application.Match(TextBox6.Text, .Range("A:A"), 0)
If Not IsError(vartmp1) Then
Me.Tag = vartmp1
TextBox6.Text = .Cells(vartmp1, 2).Value
Else
Me.Tag = ""
TextBox6.Text = ""
End If
End With
End Sub
Private Sub SpinButton3_Change()
Image3.Picture = LoadPicture(arrfotos2(SpinButton3))
Label6 = SpinButton3 + 1
TextBox9 = arrfotos2(SpinButton3)
Repaint
Dim vartmp As Variant
With Tabelle15 'Mitarbeiter
vartmp = Application.Match(TextBox10.Text, .Range("A:A"), 0)
If Not IsError(vartmp) Then
Me.Tag = vartmp
TextBox10.Text = .Cells(vartmp, 2).Value
Else
Me.Tag = ""
TextBox10.Text = ""
End If
End With
End Sub
Private Sub SpinButton4_Change()
Image4.Picture = LoadPicture(arrfotos3(SpinButton4))
Label13 = SpinButton4 + 1
TextBox13 = arrfotos3(SpinButton4)
Repaint
End Sub
Private Sub SpinButton5_Change()
Image5.Picture = LoadPicture(arrfotos4(SpinButton5))
Label20 = SpinButton5 + 1
TextBox17 = arrfotos4(SpinButton5)
Repaint
End Sub
Private Sub UserForm_Activate()
'Register 1
Dim oFotos As Object, sFile As String
Dim sPath As String
sPath = Sheets("Bildpfad").Cells(2, 2) & "Kein Foto\"
Set oFotos = CreateObject("Scripting.Dictionary")
Dim Verz As String
Verz = Sheets("Bildpfad").Cells(2, 2)
sFile = Dir(Verz & "*.jpg")
Do While sFile ""
oFotos(Verz & sFile) = 0
sFile = Dir
Loop
arrFotos = oFotos.keys
SpinButton1.Max = oFotos.Count - 1
TextBox1 = arrFotos(0)
Image1.Picture = LoadPicture(arrFotos(0))
Label1 = "1"
Label2 = oFotos.Count
'Register 2
Dim oFotos1 As Object, sFile1 As String
Dim sPath1 As String
sPath1 = Sheets("Bildpfad").Cells(3, 2) & "Kein Foto\"
Set oFotos1 = CreateObject("Scripting.Dictionary")
Dim Verz1 As String
Verz1 = Sheets("Bildpfad").Cells(3, 2)
sFile1 = Dir(Verz1 & "*.jpg")
Do While sFile1 ""
oFotos1(Verz1 & sFile1) = 0
sFile1 = Dir
Loop
arrfotos1 = oFotos1.keys
SpinButton2.Max = oFotos1.Count - 1
TextBox5 = arrfotos1(0)
Image2.Picture = LoadPicture(arrfotos1(0))
Label4 = "1"
Label5 = oFotos1.Count
'Register 3
Dim oFotos2 As Object, sFile2 As String
Dim sPath2 As String
sPath2 = Sheets("Bildpfad").Cells(4, 2) & "Kein Foto\"
Set oFotos2 = CreateObject("Scripting.Dictionary")
Dim Verz2 As String
Verz2 = Sheets("Bildpfad").Cells(4, 2)
sFile2 = Dir(Verz2 & "*.jpg")
Do While sFile2 ""
oFotos2(Verz2 & sFile2) = 0
sFile2 = Dir
Loop
arrfotos2 = oFotos2.keys
SpinButton3.Max = oFotos2.Count - 1
TextBox9 = arrfotos2(0)
Image3.Picture = LoadPicture(arrfotos2(0))
Label6 = "1"
Label7 = oFotos2.Count
'Register 4
Dim oFotos3 As Object, sFile3 As String
Dim sPath3 As String
sPath3 = Sheets("Bildpfad").Cells(5, 2) & "Kein Foto\"
Set oFotos3 = CreateObject("Scripting.Dictionary")
Dim Verz3 As String
Verz3 = Sheets("Bildpfad").Cells(5, 2)
sFile3 = Dir(Verz3 & "*.jpg")
Do While sFile3 ""
oFotos3(Verz3 & sFile3) = 0
sFile3 = Dir
Loop
arrfotos3 = oFotos3.keys
SpinButton4.Max = oFotos3.Count - 1
TextBox13 = arrfotos3(0)
Image4.Picture = LoadPicture(arrfotos3(0))
Label13 = "1"
Label14 = oFotos3.Count
'Register 5
Dim oFotos4 As Object, sFile4 As String
Dim sPath4 As String
sPath4 = Sheets("Bildpfad").Cells(6, 2) & "Kein Foto\"
Set oFotos4 = CreateObject("Scripting.Dictionary")
Dim Verz4 As String
Verz4 = Sheets("Bildpfad").Cells(6, 2)
sFile4 = Dir(Verz4 & "*.jpg")
Do While sFile4 ""
oFotos4(Verz4 & sFile4) = 0
sFile4 = Dir
Loop
arrfotos4 = oFotos4.keys
SpinButton5.Max = oFotos4.Count - 1
TextBox17 = arrfotos4(0)
Image5.Picture = LoadPicture(arrfotos4(0))
Label20 = "1"
Label21 = oFotos4.Count
End Sub
Gruß Amina