Bonjour,
Je souhaiterais pouvoir boucler sur tous les userform de tous les classeurs afin de pouvoir centrer les userform visibles.
Le code que j'utilise me renvoie systématiquement "Faux" pour:Le code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part VBA.UserForms.Add(sVariable).Visible
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Sub UsfOuverts() Dim Wb As Workbook For Each Wb In Application.Workbooks Debug.Print Wb.Name Debug.Print Windows("OutilsRechercheetSuivi2.xlsm").Visible If ActiveWorkbook.Name = "OutilsRechercheetSuivi2.xlsm" And Windows("OutilsRechercheetSuivi2.xlsm").Visible = "Faux" Then Windows("OutilsRechercheetSuivi2.xlsm").Visible = True End If Wb.Activate Dim usf As Object For Each usf In ThisWorkbook.VBProject.VBComponents Debug.Print usf.Type If usf.Type = 3 Then ' si c est un userform ( donc ni une feuille ni un module ni thisworkbook ) Debug.Print usf.Name 'End If ' sVariable = usf.Name Debug.Print ActiveWorkbook.Name & " " & sVariable & " " & VBA.UserForms.Add(sVariable).Visible Application.StatusBar = ActiveWorkbook.Name & " " & sVariable & " " & VBA.UserForms.Add(sVariable).Visible UserForm10.Label23.Caption = Application.StatusBar If VBA.UserForms.Add(sVariable).Visible = "Vrai" Then VBA.UserForms.Add(sVariable).StartUpPosition = 2 End If End If Next usf If ActiveWorkbook.Name = "OutilsRechercheetSuivi2.xlsm" Then Windows("OutilsRechercheetSuivi2.xlsm").Visible = False End If Next Wb End Sub
Est-ce que quelqu'un voit quelque chose.
MERCIE BEAUCOUP D'AVANCE!!!!
Partager