Excel

Speed Up Excel Startup

Ease of Use

Intermediate

Version tested with

Excel 2000 

Submitted by:

tommy bak

Description:

This VB script deletes Excel's toolbar file, *.xlb. 

Discussion:

On some computers, Excel's toolbar file tends to grow very big. Eventually, this can slow down Excel's startup and make the opening of big files impossible. I have just experienced this problem on a coworker's computer. She had difficulty opening her regular files and Excel seemed to crawl. We discovered that her toolbar file had bloatet to 12.5MB (12,500KB) which Excel had to load on startup. Normal size for an XLB file is somewhere between 14KB and 25KB. After deleting the XLB file, the problems disappeared. WARNING: The file "regenerates" itself, but all of your personal menu settings are gone and must be re-customized. 

Code:

instructions for use

			

Dim usrname Dim path2000XP Dim path98NTME Dim path98NoProfile Dim fso Dim objWSH Dim answer answer = msgbox ("This script deletes Excel's toolbar file." & vbcrlf & _ "Please ensure that Excel is closed, so that the code will run properly." & vbcrlf & _ "Press OK to continue, Cancel to stop", vbokcancel) If answer <> vbOK Then wscript.quit(1) 'Find login-name Set objWSH = CreateObject("WScript.Network") usrname=objWSH.UserName 'Path to excel.xlb. First and second or win98 & NT, third for win2000 & XP path98NoProfile = "C:\Windows\Application Data\Microsoft\Excel\excel*.xlb" path98NTME = "C:\Windows\Profiles\" & usrname & "\Application Data\Microsoft\Excel\excel*.xlb" path2000XP = "C:\Documents and Settings\" & usrname & "\Application Data\Microsoft\Excel\excel*.xlb" Set fso = CreateObject("scripting.filesystemobject") 'Delete excel.xlb. If not exists goto next On Error Resume Next fso.deletefile path98NoProfile fso.deletefile path98NTME fso.deletefile path2000XP 'Clean up Set fso = Nothing Set objWSH = Nothing 'Show Finished and exit msgbox "xlb-file is deleted"

How to use:

  1. This script is NOT VBA, but a vbscript.
  2. Copy the code into Notepad.
  3. Then save it as e.g. RemoveXLB.vbs to your desktop. (make sure that the extension is correct)
  4. Close the file.
 

Test the code:

  1. Make sure that Excel is closed or the script will have no effect.
  2. For safekeeping, please make copies of any *.XLB files before testing.
  3. Now click / doubleclick the file on your desktop to run the script. NOTE: This script will have no effect if VB scripting has been disabled on your computer. NOTE: Your virus scanner may warn you of a potentially dangerous script; you can choose to let it continue to run until finished.
 

Sample File:

Removexlb.zip 0.66KB 

Approved by mdmackillop


This entry has been viewed 700 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express