von nusta88 » Do, 28.06.2007 16:36
Sooo ich bin damit ganz weit gekommen, aber habe drei Sachen nicht geschaft die sich sehr ähnel. Und komma du hast mir weitergehofen thx. Was nicht funktinoiert hab ich mit einem Kommentar bekennzeichnet.
Code: Alles auswählen
Private Sub Boni1_Change()
Dim oSheets as Object, oDpage as Object, oForm as Object, oView, Boni1 as Object, Boni12 as string
oSheets = ThisComponent.CurrentController.ActiveSheet
oSheets.Unprotect "liza"
oSheet = ThisComponent.Sheets.getByName("Kalkulationsblatt")
oDpage = oSheet.DrawPage
oForm = oDpage.Forms.getByName("K")
oView = ThisComponent.CurrentController
Boni1 = oForm.getByName("Boni1")
Boni12 = oView.GetControl(Boni1).getselectedItem
ret = True
Call PruefeAuswahl(1, Boni12)
If (ret = True) Then
If (Boni12 <> " " And Boni12 <> "") Then
oSheet.getCellbyPosition(3, 7).select 'Funktioniert nicht
Else
oSheet.getCellbyPosition(5, 7).setformula(Null) 'Funktioniert auch nicht
Cells(8, 4) = Null
End If
oSheet.getCell(0, 7).setFormula(Me.Boni1 + " ") 'Funktioniert auch nicht
End If
'OSheets.Protect "liza"
End Sub
Private Sub PruefeAuswahl(ind, auswahl)
Dim oSheets as Object, oDpage as Object, oForm as Object, oView, Boni1 as Object, Boni2 as Object, Boni3 as Object, Boni4 as Object, Boni5 as Object
Dim Boni12 as string, Boni22 as string, Boni32 as string, Boni42 as string, Boni52 as string
oSheet = ThisComponent.Sheets.getByName("Kalkulationsblatt")
oSheet2 = ThisComponent.Sheets.getByName("Formeln")
oDpage = oSheet.DrawPage
oForm = oDpage.Forms.getByName("K")
oView = ThisComponent.CurrentController
Boni1 = oForm.getByName("Boni1")
Boni2 = oForm.getByName("Boni2")
Boni3 = oForm.getByName("Boni3")
Boni4 = oForm.getByName("Boni4")
Boni5 = oForm.getByName("Boni5")
Boni1 = oForm.getByName("Boni1")
Boni12 = oView.GetControl(Boni1).getselectedItem
Boni22 = oView.GetControl(Boni2).getselectedItem
Boni32 = oView.GetControl(Boni3).getselectedItem
Boni42 = oView.GetControl(Boni4).getselectedItem
Boni52 = oView.GetControl(Boni5).getselectedItem
ret = False
If (Auswahl <> " " And Auswahl <> "") Then
If ((ind <> 1 And auswahl = Boni12) _
Or(ind <> 2 And auswahl = Boni22) _
Or (ind <> 3 And Auswahl = Boni32) _
Or (ind <> 4 And Auswahl = Boni42) _
Or (ind <> 5 And Auswahl = Boni52)) Then
MsgBox ("Dieser Eintrag wurde bereits ausgewählt. Doppelte Einträge sind nicht erlaubt!")
'auswahl.Activate
Else: ret = True
End If
Else: ret = True
End If
End Sub
Sooo ich bin damit ganz weit gekommen, aber habe drei Sachen nicht geschaft die sich sehr ähnel. Und komma du hast mir weitergehofen thx. Was nicht funktinoiert hab ich mit einem Kommentar bekennzeichnet.
[code]Private Sub Boni1_Change()
Dim oSheets as Object, oDpage as Object, oForm as Object, oView, Boni1 as Object, Boni12 as string
oSheets = ThisComponent.CurrentController.ActiveSheet
oSheets.Unprotect "liza"
oSheet = ThisComponent.Sheets.getByName("Kalkulationsblatt")
oDpage = oSheet.DrawPage
oForm = oDpage.Forms.getByName("K")
oView = ThisComponent.CurrentController
Boni1 = oForm.getByName("Boni1")
Boni12 = oView.GetControl(Boni1).getselectedItem
ret = True
Call PruefeAuswahl(1, Boni12)
If (ret = True) Then
If (Boni12 <> " " And Boni12 <> "") Then
oSheet.getCellbyPosition(3, 7).select 'Funktioniert nicht
Else
oSheet.getCellbyPosition(5, 7).setformula(Null) 'Funktioniert auch nicht
Cells(8, 4) = Null
End If
oSheet.getCell(0, 7).setFormula(Me.Boni1 + " ") 'Funktioniert auch nicht
End If
'OSheets.Protect "liza"
End Sub
Private Sub PruefeAuswahl(ind, auswahl)
Dim oSheets as Object, oDpage as Object, oForm as Object, oView, Boni1 as Object, Boni2 as Object, Boni3 as Object, Boni4 as Object, Boni5 as Object
Dim Boni12 as string, Boni22 as string, Boni32 as string, Boni42 as string, Boni52 as string
oSheet = ThisComponent.Sheets.getByName("Kalkulationsblatt")
oSheet2 = ThisComponent.Sheets.getByName("Formeln")
oDpage = oSheet.DrawPage
oForm = oDpage.Forms.getByName("K")
oView = ThisComponent.CurrentController
Boni1 = oForm.getByName("Boni1")
Boni2 = oForm.getByName("Boni2")
Boni3 = oForm.getByName("Boni3")
Boni4 = oForm.getByName("Boni4")
Boni5 = oForm.getByName("Boni5")
Boni1 = oForm.getByName("Boni1")
Boni12 = oView.GetControl(Boni1).getselectedItem
Boni22 = oView.GetControl(Boni2).getselectedItem
Boni32 = oView.GetControl(Boni3).getselectedItem
Boni42 = oView.GetControl(Boni4).getselectedItem
Boni52 = oView.GetControl(Boni5).getselectedItem
ret = False
If (Auswahl <> " " And Auswahl <> "") Then
If ((ind <> 1 And auswahl = Boni12) _
Or(ind <> 2 And auswahl = Boni22) _
Or (ind <> 3 And Auswahl = Boni32) _
Or (ind <> 4 And Auswahl = Boni42) _
Or (ind <> 5 And Auswahl = Boni52)) Then
MsgBox ("Dieser Eintrag wurde bereits ausgewählt. Doppelte Einträge sind nicht erlaubt!")
'auswahl.Activate
Else: ret = True
End If
Else: ret = True
End If
End Sub[/code]