0
嗨 我使用下面的代碼(抱歉不能提供信用,我不知道從哪裏得到它)要改變Excel中的excel圖標從通常的excel圖標我已經做了一個圖標。不能更改excel圖標(在任務欄中)與vba
但它不工作...只改變應用的左上角(不是任務欄)
然而,當我在VBA窗口中直接運行代碼,它改變了小圖標我的圖標vba窗口的任務欄圖標!
我認爲它看到則activeWindow爲當前窗口被打開時(直接運行VBA窗口),但打開這本書時,它不採取行動以同樣的方式...
我使用Windows 7
我希望有人能幫助....
Declare Function GetActiveWindow32 Lib "user32" Alias "GetActiveWindow"() As Integer
Declare Function SendMessage32 Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function ExtractIcon32 Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Sub ChangeApplicationIcon()
'*****Change Icon To Suit*******
NewIcon = ThisWorkbook.Path & "\MYICON.ICO"
'*****************************
Icon = ExtractIcon32(0, NewIcon, 0)
SendMessage32 GetActiveWindow32(), &H80, 0, Icon '< 1 = big Icon
SendMessage32 GetActiveWindow32(), &H80, 1, Icon '< 0 = small Icon
ActiveWindow.Caption = "MY APPLICATION"
End Sub