Fermer excel sans les alertes

cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003 - 13 mai 2003 à 09:24
kalobit Messages postés 169 Date d'inscription mardi 15 juillet 2003 Statut Membre Dernière intervention 7 avril 2008 - 11 juin 2004 à 12:20
voila, j'ecris des choses dans excel et à la fin, l'utilisateur peut choisir de ne pas sauvegarder. Avant j'avais réussi mais a chaque fois il me disai "voulez vous fermer le classeur ...".

Mais ça plait pas à mon tuteur de stage donc la j'ai rajouté A_EXCEL.DisplayAlerts = False

le problème c'est que maintenant il bloque sur A_EXCEL.ActiveWorkbook.Close en disant "variable objet ou variable bloc with non définie" et je comprend pas.

Auriez vous une idée ?

17 réponses

stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 09:44
chez mois il le fait

Sub test()

Dim A_EXCEL As Application

Set A_EXCEL = Excel.Application
A_EXCEL.DisplayAlerts False> A_EXCEL.ActiveWorkbook.Close ou A_EXCEL.Quit

End Sub
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 09:49
OK, je me suis emballée un peu trop vite, c'est que ça fermait une fois avec le bouton quitter, et une autre avec form_unload.
Mais bon c'est que le premier problème de la journée, je sent qu'il va y en avaoir des bien pires !
Merci de t'être soucié de ma misérable existence lol
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 09:57
lol , moi je reste tout la journée donc ... ;-)
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 10:43
peut etre que donc tu pourai m'aider a trouver comment on colore les 3 premières colonnes d'un tableau excel. J'ai fait:

A_EXCEL.Worksheets(1).Cols(1).Interior.Color = RGB(191, 0, 191)
A_EXCEL.Worksheets(1).Cols(2).Interior.Color = RGB(191, 0, 191)
A_EXCEL.Worksheets(1).Cols(3).Interior.Color = RGB(191, 0, 191)

mais ça marche pas.
et quand je met cells au lieu de colls ça prend qu'une cellule à la fois

merci d'avance.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 10:56
qqch comme ca

Dim A_EXCEL As Application

Set A_EXCEL = Excel.Application

A_EXCEL.Worksheets(1).Columns(1).Interior.ColorIndex = 5
' toujours >=1 and <=55
A_EXCEL.Worksheets(1).Columns(2).Interior.ColorIndex = 5
A_EXCEL.Worksheets(1).Columns(3).Interior.ColorIndex = 5
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 10:58
ca est plus facille

Dim A_EXCEL As Application

Set A_EXCEL = Excel.Application

A_EXCEL.Worksheets(1).Columns(1).Interior.Color = RGB(191, 0, 191)
A_EXCEL.Worksheets(1).Columns(2).Interior.Color = RGB(191, 0, 191)
A_EXCEL.Worksheets(1).Columns(3).Interior.Color = RGB(191, 0, 191)
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 11:03
merci ça marche, mais si je veux mettre C0C0FF comme couleur, je fais quoi ?
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 11:25
la je peux pas t'aider . La seul chose que j'au trouvé c'est ca

http://www.cs.utsa.edu/~wagner/colors/colors5.html
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 13:52
OK, merci. Je suis peut être usante mais j'ai une autre question : quand je met ces belles couleurs on ne voit plus le quadrillage du tableau et c'est pas facile pour lire les resulats, donc, comment faire apparaitre les quadrillage ?
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 13:58
qound tu fais ca , to vois toutes

Cells.Select => selectionement => sheet
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
' Range("J11").Select
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 14:22
il plante pour chaque mot qui commence par xl
J'avais déja vu cette formule en essayant une macro excel mais apparement avec VB ça marche pas.
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 14:35
voila ...

tu remplace xlAutomatic par -4105 ...

xlAutomatic -4105
xlContinuous 1
xlDiagonalUp 6
xlEdgeBottom 9
xlEdgeLeft 7
xlEdgeRight 10
xlEdgeTop 8
xlInsideHorizontal 12
xlInsideVertical 11
xlNone -4142
xlThin 2
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 14:54
et xldiagonaldown ?
et quand tu met Cells.Select => selectionement => sheet,
ça veut dire A_EXCEL.worksheet(1).cells.select ?
si ça marche je t'en serai eternelement reconnaisante (au moins jusqu'a ce soir lol)
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 15:04
voila : xlDiagonalDown = 5

Dim A_EXCEL As Application

Set A_EXCEL = Excel.Application

A_EXCEL.Worksheets(1).Cells.Select
A_EXCEL.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
A_EXCEL.Selection.Borders(xlDiagonalUp).LineStyle = xlNone

With A_EXCEL.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With A_EXCEL.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With A_EXCEL.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With A_EXCEL.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With A_EXCEL.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With A_EXCEL.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
0
cs_joina Messages postés 31 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 23 mai 2003
13 mai 2003 à 15:15
MERCI BOCOU, je sais meme pas ce que je deviendrai sans toutes ces gentilles personnes du forum qui m'aident tous les jours.
0
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
13 mai 2003 à 15:20
Bonne prog ! Le helpdesk est fermé dans 30 min ...
lol ;-)
0
kalobit Messages postés 169 Date d'inscription mardi 15 juillet 2003 Statut Membre Dernière intervention 7 avril 2008 2
11 juin 2004 à 12:20
Le truc très simple pour fermer sans l'alèrte d'enregistrement
c'est d'appliquer la valeur true à la propriété saved de ton classeur.

en gros, tu rajoute

ThisWorkbook.Saved = True dans la procédure
WorkBook_BeforeClose

Comme ça pour excel, il n'y a eu aucune modification depuis le dernier enregistrement.

N'oublie pas tout de même de gérer toi même l'enregistrement.

au besoin, je te passe mon code

++
0
Rejoignez-nous