Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Excel > Macros et VBA Excel
Macros et VBA Excel Vos questions relatives aux macros Excel, à l'utilisation de VBA et à l'automatisation de vos classeurs Excel.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 28/10/2011, 15h04   #1
Invité régulier
 
Inscription : février 2007
Messages : 16
Détails du profil
Informations forums :
Inscription : février 2007
Messages : 16
Points : 7
Points : 7
Par défaut Incompatibilité excel 2010 32bits et 64bits

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 :
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 :
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
goingoin6 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/10/2011, 18h24   #2
Responsable Access
 
Avatar de Arkham46
 
Inscription : septembre 2003
Messages : 4 300
Détails du profil
Informations personnelles :
Localisation : France, Loiret (Centre)

Informations forums :
Inscription : septembre 2003
Messages : 4 300
Points : 7 939
Points : 7 939
Bonjour,

Un article sur le sujet :
http://arkham46.developpez.com/artic...ice/vba64bits/
__________________
Assistant de création/modification de rubans Office
Utilisez en VBA les librairies graphiques GDI, GDI+ et openGL

Blog Office Mon Site DVP
Arkham46 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h13.


 
 
 
 
Partenaires

Hébergement Web