首先在要改的工作薄相同路径放一个ICO图标,用来作为更改后要显示的图标. 1、 Option Explicit Public Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Const WM_SETICON = &H80 2、 Private Sub Workbook_Open() Dim IconPath As Variant Dim hIcon As Long IconPath = ThisWorkbook.Path & "\MSN.ICO" hIcon = ExtractIcon(0, IconPath, 0) SendMessage FindWindow("XLMAIN", Application.Caption), WM_SETICON, 1, hIcon Application.Caption = "我的财务系统" End Sub
|