tags:

views:

28

answers:

1

I managed to write some code to change the Excel application icon. See this post.

As a follow up how can I change the icon that sits directly below the Excel application icon? I want to change the workbook icon as well. Any ideas? Thanks!

A: 
Dim hWndExcel As Long
Dim hWndDesk As Long
Dim hIcon As Long

//Get the main Excel window
hWndExcel = FindWindow("XLMAIN", Application.Caption)

//Find the desktop
hWndDesk = FindWindowEx(hWndExcel, 0, "XLDESK", vbNullString)

//Find the workbook window
WorkbookWindowhWnd = FindWindowEx(hWndDesk, 0, "EXCEL7", "TRAM Dev.xls")

/Get the icon handle
hIcon = ExtractIcon(0, "d:\tram.ico", 0)

//Set the big (32x32) and small (16x16) icons
SendMessage WorkbookWindowhWnd, WM_SETICON, 1, hIcon
SendMessage WorkbookWindowhWnd, WM_SETICON, 0, hIcon

Application.ScreenUpdating = True
xiaodai
This works fine for Excel 2003
xiaodai