Bonjour,
J'ai lu cette discussion.
J'ai le même problème mais je ne sais pas quoi faire, car, c'est pas qui a fait le code, du coup je ne sais si tu peux m'aider stp ?
Version imprimable
Bonjour,
J'ai lu cette discussion.
J'ai le même problème mais je ne sais pas quoi faire, car, c'est pas qui a fait le code, du coup je ne sais si tu peux m'aider stp ?
Point important, les régions pour 32 ou 64 bits....
Code:
1
2
3
4
5 #if Win64 then Declare PtrSafe Function.... #else Declare Function.... #end if
J'ai pas compris, tu peux m'expliquer mieux stp ?
+1 @Marc-L entre le lien vers l'article et ma réponse tu as tout pour comprendre et résoudre ton problème :)
Oui merci pour ta repose, le problème c'est je comprend rien car j'ai jamais fait du VBA, du coup je cherche qlq'un qui pourra vraiment m'expliquer les choses...
Justement, lis l'article et tu en saura plus, ils sont justement fait pour apprendre !
je viens de lire mais vraiment j'ai rien compris de ce qu'il raconte,
voila ce qu'il m'affiche dans mon écran
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Public Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetWindowRect Lib "user32" _ (ByVal hwnd As Long, lpRect As RECT) As Long Public Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Public Declare Function SetWindowPos Lib "user32" _ (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _ ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _ ByVal wFlags As Long) As Long Private Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Bonjour,
dans le poste #2 cerede2000 te parle de directive de compilation! car en fonction de la version les déclaration sont différente.
Code:
1
2
3
4
5 #if Win64 then Declare PtrSafe Function.... #else Declare Function.... #end if
l'article du poste #2 de la discussion originale t'expliques la différence et là une lecture s'impose et te voilà seule face au mode!
Code:Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Code:Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Salut, @ielharras : fais des recherches sur la compilation conditionnelle
https://msdn.microsoft.com/fr-fr/lib...=vs.90%29.aspx
Je te remercier pour ta réponse.
Le problème c'est que c'est pas du tt domaine j'ai du mal a comprendre tt ça, je cherche juste une réponse fluide qui pourra me guider a régler le problème. Tu veux dire quoi avec le poste #2 et #5 ? faut que je rajoute qlq chose dans les paramètre pour que je puisse régler le problème ?
le problème est qu'il faut ce documenter un minimum et nous ne pouvons pas le faire pour toi!
tu as toutes les informations dans ce poste il ne te reste que du rédactionnel! demande à un ou une assistant(e) de faire la saisie à ta place!
il n'y a plus rien à comprendre, mon dernier poste te dis ce qu'il faut faire sens avoir besoin de réfléchir!
Code:
1
2
3
4
5 #if Win64 then Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long #else Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long #end if
Merci, j'ai réussi a le corriger faire moi même, mais j'ai un autre problème quand je compile le programme il m'affiche:
erreur d’exécution '1004' impossible de lire la propriété pivottable
et le code c'est celui là :
Code:
1
2
3
4
5
6
7
8
9
10
11
12 If Application.WorksheetFunction.CountIf(wksht_passport_form.Columns("G"), True) > 0 Then .PivotTables("TCD_form_niv_cslt").PivotFields(" Applicabilité consultant").ClearAllFilters .PivotTables("TCD_form_niv_cslt").PivotFields(" Applicabilité consultant").CurrentPage = "TRUE" .PivotTables("TCD_avancement_formation").PivotFields(" Applicabilité consultant").ClearAllFilters .PivotTables("TCD_avancement_formation").PivotFields(" Applicabilité consultant").CurrentPage = "TRUE" Else End If If Application.WorksheetFunction.CountIf(wksht_passport_form.Columns("K"), True) > 0 Then .PivotTables("TCD_avancement_formation").PivotFields(" Consultant à former").ClearAllFilters .PivotTables("TCD_avancement_formation").PivotFields(" Consultant à former").CurrentPage = "TRUE" End If End With
Plus rien a voir avec le problème de compatibilité x32/x64 mais bon...
Le bout de code que tu donne n'est pas suffisant pour voir le problème.
Etant donné que tu appel la propriété .PivotTable directement tu dois avoir un With avant.
Il serais bien de mettre donc code avec le With... / End With
Merci d'abord pour votre réponse,
voila 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 Private Sub Worksheet_Activate() If Application.WorksheetFunction.CountIf(wksht_passport_form.Columns("G"), True) = 0 Then wksht_passport_form.Activate MsgBox "Aucune compétence applicable au consultant n'a été définie.", vbCritical Exit Sub End If If Application.WorksheetFunction.CountIf(wksht_passport_form.Columns("K"), True) = 0 Then wksht_radar_form.ChartObjects("grph_radar_avcmt_form").Visible = False MsgBox "Attention : Aucun besoin de formation n'a été définie pour ce consultant. Le graphique relatif à l'avancement de la formation sera donc masqué.", vbExclamation Else wksht_radar_form.ChartObjects("grph_radar_avcmt_form").Visible = True End If Application.ScreenUpdating = False wksht_passport_form.Unprotect Password:=mdp_protect Call AdjustPivotDataRange(wksht_passport_form, _ wksht_tcd_formation, _ wksht_passport_form.Range("A" & ligne_debut_tab_passeport), _ "TCD_form_niv_cslt") Call AdjustPivotDataRange(wksht_passport_form, _ wksht_tcd_formation, _ wksht_passport_form.Range("A" & ligne_debut_tab_passeport), _ "TCD_avancement_formation") With wksht_tcd_formation .Unprotect Password:=mdp_protect .PivotTables("TCD_form_niv_cslt").PivotCache.Refresh .PivotTables("TCD_avancement_formation").PivotCache.Refresh If Application.WorksheetFunction.CountIf(wksht_passport_form.Columns("G"), True) > 0 Then .PivotTables("TCD_form_niv_cslt").PivotFields(" Applicabilité consultant").ClearAllFilters .PivotTables("TCD_form_niv_cslt").PivotFields(" Applicabilité consultant").CurrentPage = "TRUE" .PivotTables("TCD_avancement_formation").PivotFields(" Applicabilité consultant").ClearAllFilters .PivotTables("TCD_avancement_formation").PivotFields(" Applicabilité consultant").CurrentPage = "TRUE" Else End If If Application.WorksheetFunction.CountIf(wksht_passport_form.Columns("K"), True) > 0 Then .PivotTables("TCD_avancement_formation").PivotFields(" Consultant à former").ClearAllFilters .PivotTables("TCD_avancement_formation").PivotFields(" Consultant à former").CurrentPage = "TRUE" End If End With wksht_passport_form.Protect Password:=mdp_protect, AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowFiltering:=True, AllowUsingPivotTables:=True wksht_tcd_formation.Protect Password:=mdp_protect, AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowFiltering:=True, AllowUsingPivotTables:=True Application.ScreenUpdating = True End Sub