Bonjour,

Je souhaite supprimer la croix des formulaires.

j'ai récupéré un code qui fonctionne bien sous excel 2010 32bits mais si je teste sur un ordinateur qui a excel 2010 64bits ca ne fonctionne pas!
Du coup j'ai trouvé un autre code qui fonctionne sous 64bits mais qui ne fonctionne plus sous 32bits...


voici le code:

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
'code pr excel 2010 32bits
 
Private Declare Function GetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
 
Private Declare Function SetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
 
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
 
Private Sub UserForm_Initialize()
Dim hwnd As Long
hwnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", "X", "D") & "Frame", Me.Caption)
SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF
End Sub
 
 
 
' code pour excel 2010 64 bits
 
Private Declare PtrSafe Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
 
Private Declare PtrSafe Function SetWindowLongPtr Lib "USER32" Alias "SetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
 
Private Declare PtrSafe Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
 
 
Private Sub UserForm_Initialize()
Dim hWnd As LongPtr
hWnd = FindWindow("Thunder" & IIf(Application.Version Like "8*", _
    "X", "D") & "Frame", Me.Caption)
SetWindowLongPtr hWnd, -16, GetWindowLong(hWnd, -16) And &HFFF7FFFF
End Sub
donc ensuite j'ai essayé de récupérer la version d'excel et d'écrire le code correspondant selon la version. Mais quand je veux parcourir mes feuilles il me met "erreur défini par l'application ou par l'objet". Et je comprend pas pourquoi il bloque là dessus(code en gras):

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
Private Sub fctdeclare()

Dim i As Integer
Dim vbs As Variant

    If Application.Version = "12.0" Then 'version excel 2007
  
        For Each vbs In Me.VBProject.VBComponents
            
            If Left(vbs.Name, 2) = "UF" And vbs.Name <> "UF_InfoMolecule" then
              ...mon code pr ecrire...  
            End If
    
        Next
  end if
end sub
voilà si quelqu'un à déjà eu ce problème, c'est avec plaisir que j'accepte son aide
merci d'avance.

gwen