+ Reply to Thread
Results 1 to 17 of 17

Change File Icon and/or Title Bar Icon

  1. #1
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Change File Icon and/or Title Bar Icon

    Hi all,

    I have searching furiously all morning and have had no luck finding a code to work properly.

    I am trying to create a real "program feel" to the project I am working on, and want to know if it even possible to use my own icon that i have created. I have relocated the file to
    "C:\Windows\System32\LabTech1.ico", but can relocate if needed.

    I have been able to make one code change the Title Bar Icon to Notepad (but I have to assume that is considered childs play to most of you at this point), and I tried fruitlessly to modify it to suit my needs.
    Casey Wells

    Most Appreciative Rookie!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    This macro will change the icon for Excel 2003 using an icon from a file. This may require some changes if you are using this with excel 2007 or 2010. If you are not changing the Excel icon then this macro will be need to changed to work with any Windows window.

    Copy and paste this code into a new VBA module in your workbook's VBA project.
    Please Login or Register  to view this content.

    Example of Using th Macro
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    Leith,

    This didn't work either; so before continuing, I want to ensure I performed this properly.

    I copied/pasted your first code string into a new module.
    I then copied/pasted your sub below it.

    The only change I made to either code was to change the destination to my .ico file: "C:\Windows\System32\LabTech1.ico"

    I then tried to run the macro, but had no luck. It ran with no errors, but did nothing.

    Have I done something wrong? I do not know what I would have to change from 2003 to 2007/10.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    I am surprised you didn't receive any errors if it failed to do anything. I would expect it to either work or throw an error. Is this file an Excel workbook?

  5. #5
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    Yes, Building it on my laptop running Excel 2010, but I pasted your code into a new blank workbook. I am also at a loss, since all other codes I have tried caused errors.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    I am guessing you are running Windows 7 32 bit platform. If it 64 bit then should have been errors in the API code. I will have to research this further to find an answer.

  7. #7
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    No, It is actually Windows 7 Home Premuim - 64bit on my laptop. Running Excel 2010.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    In that case I need to make the needed changes to the 32 bit API code so it will run on a 64 bit system.

  9. #9
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    I can't thank you enough. I may be asking this prematurely, but will the 64bit version run properly on a 32bit system? I am assuming not, but don't know enough about this yet.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    64 bit code will not run correctly on a 32 bit platform.

  11. #11
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    Oh boy, that just opened a whole new can of worms!

    I will now have to run tests on my 32 bit systems at work to ensure the codes i have written to date will work across the board.

    Do you think that the original code you provided me will work on a 32 bit system then?

    I apologize for all the questions, still very new to this.

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    Delete all the previous macro code and copy and paste this code into the module. Hopefully, this will work without problems. Because this is new and untested API code, be sure to back up your workbook and close any other applications before you run this.

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    I have pasted this into a new module and ran the sub, but nothing is happening.

    The only time I received an error was when I tried to call the macro from my workbook module: Private Sub Workbook Activate ()

    The destination is in the System32 folder should that matter?

  14. #14
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    It is good the code didn't error or crash your system but now I am really mystified as to why nothing happened. Something should have happened. Maybe there is a system setting that needs to changed before the code will run. I just have no idea what it might be.

  15. #15
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    Leith,

    I cannot thank you enough for helping me out. I understand what you mean about not crashing the system, so now I guess I need to go to work and find the system setting that could be causing this.

    You will get a top notch rating from me, but I think I will leave the post unsolved until I am able to fix the problem.

    Maybe someone else will stumble upon it and offer some advice as well.

  16. #16
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change File Icon and/or Title Bar Icon

    Hello Casedias,

    It could be you have your system set to Disable all macros without notification. Check you macro security level setting and set it to Disable all macros with notification.

    If you don't know how to change the settings, click here

  17. #17
    Registered User
    Join Date
    09-15-2011
    Location
    Washington, OK
    MS-Off Ver
    Office 2010
    Posts
    23

    Re: Change File Icon and/or Title Bar Icon

    For developmental ease I have them set to enabel all, but just to test I set them to disable with notification. No change.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1