1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
REM ***** BASIC *****
' Option Explicit
Dim i as integer
Sub Main()
Dim Dlg As Object, bibli as Object
Dim monDialogue As Object
Dim champArticle As Object, article As String
Dim champPrixCol As Object, PrixCol As Integer
Dim champPrixLid As Object, Prixlid As Integer
Dim champPrixGb As Object, PrixGb As integer
i = 10
bibli = DialogLibraries.GetByName("Standard")
monDialogue = bibli.GetByName("dlgComparatif")
Dlg = CreateUnoDialog(monDialogue)
champArticle = Dlg.GetControl("txtArticles")
champArticle.Text = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("A" & i).string
article = champArticle.Text
champPrixCol = Dlg.GetControl("nfprixcol")
champPrixCol.Value = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("E" & i).value
PrixCol = champPrixCol.Value
champPrixLid = Dlg.GetControl("nfPrixLidl")
champPrixLid.Value = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("F" & i).value
PrixLid = champPrixLid.Value
champPrixGb= Dlg.GetControl("nfprixGb")
champPrixGb.Value = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("G" & i).value
PrixGb = champPrixGb.Value
If PrixCol <= PrixLid And PrixCol <= PrixGb then
thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("E" & i).CellBackColor = RGB(200, 0, 0)
End If
If PrixGb <= PrixCol And PrixGb <= PrixLid then
thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("G" & i).CellBackColor = RGB(200, 0, 0)
End If
If PrixLid <= PrixCol And PrixLid <= PrixGb then
thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("F" & i).CellBackColor = RGB(200, 0, 0)
End If
Dlg.Execute
End Sub
Rem Navigation dans le classeur
Sub NaviguerPos()
Rem Déclaration des variables
Dim Dlg As Object, bibli as Object
Dim monDialogue As Object
Dim btnSuivant as Object
Dim champArticle As Object, article As String
Dim champPrixCol As Object, PrixCol As Integer
Dim champPrixLid As Object, Prixlid As Integer
Dim champPrixGb As Object, PrixGb As integer
Rem Assignation des variables
bibli = DialogLibraries.GetByName("Standard")
monDialogue = bibli.GetByName("dlgComparatif")
Dlg = CreateUnoDialog(monDialogue)
btnSuivant = Dlg.GetControl("btnSuivant")
i = i + 1
champArticle = Dlg.GetControl("txtArticles")
champArticle.Text = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("A" & i).string
article = champArticle.Text
champPrixCol = Dlg.GetControl("nfprixcol")
champPrixCol.Value = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("E" & i).value
PrixCol = champPrixCol.Value
champPrixLid = Dlg.GetControl("nfPrixLidl")
champPrixLid.Value = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("F" & i).value
PrixLid = champPrixLid.Value
champPrixGb= Dlg.GetControl("nfprixGb")
champPrixGb.Value = thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("G" & i).value
PrixGb = champPrixGb.Value
If PrixCol <= PrixLid And PrixCol <= PrixGb then
thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("E" & i).CellBackColor = RGB(200, 0, 0)
End If
If PrixGb <= PrixCol And PrixGb <= PrixLid then
thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("G" & i).CellBackColor = RGB(200, 0, 0)
End If
If PrixLid <= PrixCol And PrixLid <= PrixGb then
thisComponent.Sheets.getByIndex(0).getCellRangeByN ame("F" & i).CellBackColor = RGB(200, 0, 0)
End If
End Sub |
Partager