Bonjour tout le monde !
Je suis en train de développer une grosse application en vba (enfin quand je dis grosse, c'est grosse pour moi) et certaines fonctions que j'utilise ne sont pas gérées nativement par vba. Je me suis ainsi rendu compte que mon application ne fonctionnait pas sur certains postes. J'ai donc fait le tour des références activées sur mon poste, j'ai copié les fichiers DLL, OCX et TLB nécessaires dans un répertoire accessible à partir du réseau et j'appelle la macro suivante dans Workbook_Open :
Mais voilà, je ne comprend pas pourquoi mais certaines références ne sont toujours pas activées sur certains postes (voir capture d'écran ci - jointe).
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 Sub ActiverReferences() Dim Path As String On Error Resume Next Application.DisplayAlerts = False Path = Range("Chemin_References").Value With ThisWorkbook.VBProject.References .AddFromFile Path & "FM20.DLL" .AddFromFile Path & "MSCOMCTL.OCX" .AddFromFile Path & "MSCAL.OCX" .AddFromFile Path & "FPDTC.DLL" .AddFromFile Path & "MSCOMCT2.OCX" .AddFromFile Path & "scrrun.dll" .AddFromFile Path & "msado21.tlb" End With Application.DisplayAlerts = True End Sub
Le problème se répète surtout pour Microsoft Calendar Control 8.0 et pour Microsoft Windows Common Controls-2 6.0 (SP6).
Si quelqu'un pouvait me dire comment résoudre ce problème, j'avoue que ça m'arrangerai beaucoup.
Ce problème me bloque énormément car du coup je ne peux pas me servir de la macro suivante qui permet de supprimer le cadre autour de certains userforms :
Merci d'avance et très bonne journée à tout le monde.
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 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long Private Sub UserForm_Initialize() '############################################# '## Suppression du cadre autour du Userform ## '############################################# Dim hwnd As Long hwnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hwnd, -16) And Not &HC00000 SetWindowLong hwnd, -16, Style DrawMenuBar hwnd End Sub
Partager