2010-09-10 17 views
0

我設法寫一些代碼來改變Excel應用程序圖標。見this post如何更改Excel中的工作簿圖標?

作爲後續操作,如何更改位於Excel應用程序圖標正下方的圖標?我也想更改工作簿圖標。有任何想法嗎?謝謝!

+2

花幾分鐘時間來學習如何格式化您的問題......您已經發布22! – 2010-09-10 03:24:36

回答

0
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 
+0

這適用於Excel 2003 – xiaodai 2010-09-11 02:36:47

相關問題