Chnager la couleur d'une cellule dans un spreadsheet

funwave67 Messages postés 1 Date d'inscription jeudi 22 novembre 2007 Statut Membre Dernière intervention 4 mars 2008 - 4 mars 2008 à 13:06
cs_dahbia Messages postés 33 Date d'inscription mardi 21 décembre 2004 Statut Membre Dernière intervention 4 février 2015 - 16 sept. 2008 à 13:30
Bonjour à tous,

je desire changer la couleur d'une cellule d'une feuille excel ouverte dans un spreadsheet sous VB6.

pouvez vous me donner la methode.

Merci.

1 réponse

cs_dahbia Messages postés 33 Date d'inscription mardi 21 décembre 2004 Statut Membre Dernière intervention 4 février 2015
16 sept. 2008 à 13:30
Bonjour,
J'espere que ce petit code va te permetre de trouver ce que tu veux.

Private Sub Command1_Click()
  With Spreadsheet1
  .ToolTipText = "Feuille excel  pour l'exporter ,cliquez sur l'icon d'excel et le tour est joué"
  .ActiveSheet.ConnectionString = cnx.ConnectionString
  .ActiveSheet.CommandText = "SELECT * from apps.AT_MAJ_RAP_BQE"
  .DisplayTitleBar = True
  .TitleBar.Font.Name = "Garamond"      'Style d'ecriture
  .TitleBar.Font.Size = 12                        'Taille
  .ActiveWindow.DisplayGridlines = True
  .TitleBar.Caption = Me.Caption
  .TitleBar.Interior.ColorIndex = 12
  .Rows(1).Font.Bold = False
End With
Dim rngCurrentRow
   For Each rngCurrentRow In Spreadsheet1.Cells(1, 1).CurrentRegion.Rows
       If rngCurrentRow.Row Mod 2 = 0 Then
          rngCurrentRow.Interior.Color = "Lightcyan"     ' Couleur de ligne
          rngCurrentRow.Font.Bold = True
      End If
   Next
Spreadsheet1.ActiveSheet.ConnectionString = ""
Spreadsheet1.ActiveSheet.CommandText = ""
End Sub

Merci.
0
Rejoignez-nous