OVH Cloud OVH Cloud

logo classeur

6 réponses
Avatar
linux_pac
bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de titre
du classeur(book1) par exemple.



Marc merci

6 réponses

Avatar
isabelle
bonjour Marc,

jette un oeil ici,

http://xcell05.free.fr/pages/api/logo.htm

isabelle

bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de titre
du classeur(book1) par exemple.



Marc merci


Avatar
linux_pac
Merci, mais cela change le logo de la barre de titre de l'application,
pas du classeur,mais c'est peut-être une piste

"isabelle" wrote:

bonjour Marc,

jette un oeil ici,

http://xcell05.free.fr/pages/api/logo.htm

isabelle

bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de titre
du classeur(book1) par exemple.



Marc merci





Avatar
Jacques93
Bonjour ,

Tu peux essayer d'adapter le code (testé sous Excel 2003) :

Option Explicit

Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowExA Lib "user32" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Private Declare Function GetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GCL_HICON = -14

Private Declare Function LoadImageA Lib "user32" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long

Private Declare Function EnumChildWindows Lib "user32" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long

Private Const WM_NCPAINT = &H85&

Dim hIcon As Long, hWndChild As Long

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If hIcon Then SetClassLongA hWndChild, GCL_HICON, hIcon
End Sub

Private Sub Workbook_Open()
ChangeIcon
End Sub

Public Sub ChangeIcon()
Dim FIcone As String
Dim hWndParent As Long
Dim hWndDesk As Long

FIcone = Me.Path & "" & "FichierIco.ico"
If Dir$(FIcone) <> "" Then
hWndParent = FindWindowA("XLMAIN", Application.Name)
If hWndParent <> 0 Then
hWndDesk = FindWindowExA(hWndParent, 0&, "XLDESK", "")
hWndChild = FindWindowExA(hWndDesk, 0&, _
"EXCEL7", ActiveWorkbook.Name)
hIcon = GetClassLongA(hWndChild, GCL_HICON)
SetClassLongA hWndChild, GCL_HICON, _
LoadImageA(0, FIcone, 1, 0, 0, &H10)
SendMessage hWndChild, WM_NCPAINT, 1&, 0&
End If
End If

End Sub


Merci, mais cela change le logo de la barre de titre de l'application,
pas du classeur,mais c'est peut-être une piste

"isabelle" wrote:

bonjour Marc,

jette un oeil ici,

http://xcell05.free.fr/pages/api/logo.htm

isabelle

bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de titre
du classeur(book1) par exemple.



Marc merci





--
Cordialement,

Jacques.



Avatar
linux_pac
Merci jacques 93, j'ai essayé ton code(copier, coller) sous Winxp sp2, excel
2000
et dans un nouveau classeur, rien ne change ?????

"Jacques93" wrote:

Bonjour ,

Tu peux essayer d'adapter le code (testé sous Excel 2003) :

Option Explicit

Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowExA Lib "user32" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Private Declare Function GetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GCL_HICON = -14

Private Declare Function LoadImageA Lib "user32" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long

Private Declare Function EnumChildWindows Lib "user32" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long

Private Const WM_NCPAINT = &H85&

Dim hIcon As Long, hWndChild As Long

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If hIcon Then SetClassLongA hWndChild, GCL_HICON, hIcon
End Sub

Private Sub Workbook_Open()
ChangeIcon
End Sub

Public Sub ChangeIcon()
Dim FIcone As String
Dim hWndParent As Long
Dim hWndDesk As Long

FIcone = Me.Path & "" & "FichierIco.ico"
If Dir$(FIcone) <> "" Then
hWndParent = FindWindowA("XLMAIN", Application.Name)
If hWndParent <> 0 Then
hWndDesk = FindWindowExA(hWndParent, 0&, "XLDESK", "")
hWndChild = FindWindowExA(hWndDesk, 0&, _
"EXCEL7", ActiveWorkbook.Name)
hIcon = GetClassLongA(hWndChild, GCL_HICON)
SetClassLongA hWndChild, GCL_HICON, _
LoadImageA(0, FIcone, 1, 0, 0, &H10)
SendMessage hWndChild, WM_NCPAINT, 1&, 0&
End If
End If

End Sub


Merci, mais cela change le logo de la barre de titre de l'application,
pas du classeur,mais c'est peut-être une piste

"isabelle" wrote:

bonjour Marc,

jette un oeil ici,

http://xcell05.free.fr/pages/api/logo.htm

isabelle

bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de titre
du classeur(book1) par exemple.



Marc merci





--
Cordialement,

Jacques.






Avatar
Michel Pierron
Bonjour ;
Je suppose que ton classeur est maximisé à l'ouverture, auquel cas, il faut
un changement de mode pour qu'Excel prenne en compte le changement d'icône.
Au plus simple, dans le module ThisWorkbook (remplace le nom du fichier
icône "MSN.ICO par le tien propre):

Option Explicit
Private Declare Function GetFocus& Lib "user32" ()
Private Declare Function ExtractIconA& _
Lib "shell32.dll" (ByVal hInst& _
, ByVal lpszExeFileName$, ByVal nIconIndex&)
Private Declare Function GetClassLongA& _
Lib "user32" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function SetClassLongA& _
Lib "user32" (ByVal hwnd&, ByVal nIndex& _
, ByVal dwNewLong&)
Private Declare Function SendMessageA& _
Lib "user32" (ByVal hwnd&, ByVal wMsg& _
, ByVal wParam%, ByVal lParam As Any)
Private hIcon&

Private Sub Workbook_Activate()
Const f$ = "MSN.ICO"
Dim p$: p = ThisWorkbook.Path & f
If Dir(p) = "" Then Exit Sub
hIcon = GetClassLongA(GetFocus, -14)
SetClassLongA GetFocus, -14, ExtractIconA(0, p, 0)
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
End Sub

Private Sub Workbook_Deactivate()
If hIcon Then SetClassLongA GetFocus, -14, hIcon
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
End Sub

MP

"" a écrit
dans le message de news:

Merci jacques 93, j'ai essayé ton code(copier, coller) sous Winxp sp2,
excel
2000
et dans un nouveau classeur, rien ne change ?????

"Jacques93" wrote:

Bonjour ,

Tu peux essayer d'adapter le code (testé sous Excel 2003) :

Option Explicit

Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowExA Lib "user32" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Private Declare Function GetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GCL_HICON = -14

Private Declare Function LoadImageA Lib "user32" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long

Private Declare Function EnumChildWindows Lib "user32" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long

Private Const WM_NCPAINT = &H85&

Dim hIcon As Long, hWndChild As Long

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If hIcon Then SetClassLongA hWndChild, GCL_HICON, hIcon
End Sub

Private Sub Workbook_Open()
ChangeIcon
End Sub

Public Sub ChangeIcon()
Dim FIcone As String
Dim hWndParent As Long
Dim hWndDesk As Long

FIcone = Me.Path & "" & "FichierIco.ico"
If Dir$(FIcone) <> "" Then
hWndParent = FindWindowA("XLMAIN", Application.Name)
If hWndParent <> 0 Then
hWndDesk = FindWindowExA(hWndParent, 0&, "XLDESK", "")
hWndChild = FindWindowExA(hWndDesk, 0&, _
"EXCEL7", ActiveWorkbook.Name)
hIcon = GetClassLongA(hWndChild, GCL_HICON)
SetClassLongA hWndChild, GCL_HICON, _
LoadImageA(0, FIcone, 1, 0, 0, &H10)
SendMessage hWndChild, WM_NCPAINT, 1&, 0&
End If
End If

End Sub


Merci, mais cela change le logo de la barre de titre de l'application,
pas du classeur,mais c'est peut-être une piste

"isabelle" wrote:

bonjour Marc,

jette un oeil ici,

http://xcell05.free.fr/pages/api/logo.htm

isabelle

bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de
titre
du classeur(book1) par exemple.



Marc merci





--
Cordialement,

Jacques.








Avatar
linux_pac
super un grand merci

"Michel Pierron" wrote:

Bonjour ;
Je suppose que ton classeur est maximisé à l'ouverture, auquel cas, il faut
un changement de mode pour qu'Excel prenne en compte le changement d'icône.
Au plus simple, dans le module ThisWorkbook (remplace le nom du fichier
icône "MSN.ICO par le tien propre):

Option Explicit
Private Declare Function GetFocus& Lib "user32" ()
Private Declare Function ExtractIconA& _
Lib "shell32.dll" (ByVal hInst& _
, ByVal lpszExeFileName$, ByVal nIconIndex&)
Private Declare Function GetClassLongA& _
Lib "user32" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function SetClassLongA& _
Lib "user32" (ByVal hwnd&, ByVal nIndex& _
, ByVal dwNewLong&)
Private Declare Function SendMessageA& _
Lib "user32" (ByVal hwnd&, ByVal wMsg& _
, ByVal wParam%, ByVal lParam As Any)
Private hIcon&

Private Sub Workbook_Activate()
Const f$ = "MSN.ICO"
Dim p$: p = ThisWorkbook.Path & f
If Dir(p) = "" Then Exit Sub
hIcon = GetClassLongA(GetFocus, -14)
SetClassLongA GetFocus, -14, ExtractIconA(0, p, 0)
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
End Sub

Private Sub Workbook_Deactivate()
If hIcon Then SetClassLongA GetFocus, -14, hIcon
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
End Sub

MP

"" a écrit
dans le message de news:

Merci jacques 93, j'ai essayé ton code(copier, coller) sous Winxp sp2,
excel
2000
et dans un nouveau classeur, rien ne change ?????

"Jacques93" wrote:

Bonjour ,

Tu peux essayer d'adapter le code (testé sous Excel 2003) :

Option Explicit

Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowExA Lib "user32" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Private Declare Function GetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetClassLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GCL_HICON = -14

Private Declare Function LoadImageA Lib "user32" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long

Private Declare Function EnumChildWindows Lib "user32" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long

Private Const WM_NCPAINT = &H85&

Dim hIcon As Long, hWndChild As Long

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If hIcon Then SetClassLongA hWndChild, GCL_HICON, hIcon
End Sub

Private Sub Workbook_Open()
ChangeIcon
End Sub

Public Sub ChangeIcon()
Dim FIcone As String
Dim hWndParent As Long
Dim hWndDesk As Long

FIcone = Me.Path & "" & "FichierIco.ico"
If Dir$(FIcone) <> "" Then
hWndParent = FindWindowA("XLMAIN", Application.Name)
If hWndParent <> 0 Then
hWndDesk = FindWindowExA(hWndParent, 0&, "XLDESK", "")
hWndChild = FindWindowExA(hWndDesk, 0&, _
"EXCEL7", ActiveWorkbook.Name)
hIcon = GetClassLongA(hWndChild, GCL_HICON)
SetClassLongA hWndChild, GCL_HICON, _
LoadImageA(0, FIcone, 1, 0, 0, &H10)
SendMessage hWndChild, WM_NCPAINT, 1&, 0&
End If
End If

End Sub


Merci, mais cela change le logo de la barre de titre de l'application,
pas du classeur,mais c'est peut-être une piste

"isabelle" wrote:

bonjour Marc,

jette un oeil ici,

http://xcell05.free.fr/pages/api/logo.htm

isabelle

bonjour,
Comment peut'on changer le logo excel qui se trouve dans la barre de
titre
du classeur(book1) par exemple.



Marc merci





--
Cordialement,

Jacques.