|
-
Oct 7th, 2009, 07:20 PM
#1
Thread Starter
Hyperactive Member
Change Excel Icon
How do you change the excel Icon? I've been searching, and can't seem to find anything "that I understand". I found one that changes the Icon when the Workbook is open but only on the Bottom Explorer Bar. Don't understand why you would want to do that, but..
So..
1. Can you change the icon from Workbook to Workbook?
2. How do you change the Icon's for All Files?
-
Oct 8th, 2009, 02:20 AM
#2
Re: Change Excel Icon
My code to change all opened Excel workbook icons:
http://www.vbforums.com/showpost.php...04&postcount=4
If you want to you can change it to change specific workbooks to specific icons. Just need to know the filenames as they appear int he window caption bar which FindWindow can search against.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 8th, 2009, 02:30 AM
#3
Re: Change Excel Icon
Place this in a module and run ReplaceIcon
vb Code:
Option Explicit 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 Declare Function GetActiveWindow32 Lib "USER32" Alias "GetActiveWindow" _ () As Integer Sub ReplaceIcon() Dim Icon As String Const NewIcon$ = "Notepad.exe" '~~> Getting the icon from windows calculator '~~> similarly you can extract the icon from any exe '~~> if the application is not present in windows path '~~> then give complete path and file name Icon = ExtractIcon32(0, "Calc.exe", 0) '~~> you can use 1 for big icon SendMessage32 GetActiveWindow32(), &H80, 1, Icon '~~> and 0 for small icon SendMessage32 GetActiveWindow32(), &H80, 0, Icon End Sub
Edit: Speedy Rob beat me to it !!!!!
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 8th, 2009, 02:34 AM
#4
Re: Change Excel Icon
That will only change the active window. Mine will change all Excel windows even if they are minimized
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 8th, 2009, 02:36 AM
#5
Re: Change Excel Icon
Yeah I realized that after I posted and saw your post
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 8th, 2009, 02:45 AM
#6
Re: Change Excel Icon
See its a problem with GetActiveWindow32 as it can not return an active window outside of the calling thread. If the active window is some other instance of Excel then the call will return Null.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 8th, 2009, 09:44 AM
#7
Thread Starter
Hyperactive Member
Re: Change Excel Icon
Just from Reading your posts I gather it is the toolbar icon that changes upon opening of the document. Am I correct in that?
I mean in My Documents the Excel Workbook/s sitting there and they all look the same. I'm wanting for some of them have different Icon's. Possible? IF not, I would at least like to change all of them to one of the attached Icon's.
-
Oct 9th, 2009, 03:55 AM
#8
Re: Change Excel Icon
Oh you want to change the Associated Icon in Explorer. That is something totally different.
You can change individule icons for folders but not individule icons for files.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 9th, 2009, 09:13 AM
#9
Thread Starter
Hyperactive Member
Re: Change Excel Icon
Alright can you change the Associated Excel File Icon? If so how?
I got this idea from a Program I downloaded from Cnet. It was a Project manager program made by someone, and you have a certain number of days till you have to register it. It's on my other computer, but it is Excel, and it's Icon is different than all the other excel files. Maybe I should be asking how you make an excel file not an excel file but like .AXL or something.
-
Aug 4th, 2019, 04:20 PM
#10
New Member
Re: Change Excel Icon
 Originally Posted by Siddharth Rout
Place this in a module and run ReplaceIcon
vb Code:
Option Explicit
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
Declare Function GetActiveWindow32 Lib "USER32" Alias "GetActiveWindow" _
() As Integer
Sub ReplaceIcon()
Dim Icon As String
Const NewIcon$ = "Notepad.exe"
'~~> Getting the icon from windows calculator
'~~> similarly you can extract the icon from any exe
'~~> if the application is not present in windows path
'~~> then give complete path and file name
Icon = ExtractIcon32(0, "Calc.exe", 0)
'~~> you can use 1 for big icon
SendMessage32 GetActiveWindow32(), &H80, 1, Icon
'~~> and 0 for small icon
SendMessage32 GetActiveWindow32(), &H80, 0, Icon
End Sub
Edit: Speedy Rob beat me to it !!!!! 
How do I adjust the Icon size?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|