'AutoResize columns to fit contents Dim WshShell strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'Excel.exe'") If colProcesses.Count = 0 Then Wscript.Echo "Excel.exe is not running." Else 'Wscript.Echo "Excel.exe is running." 'SHIFT=+,CTRL=^,ALT=%,ENTER=~ Set WshShell = CreateObject("WScript.Shell") WshShell.AppActivate "Microsoft Excel" WScript.Sleep 200 WshShell.SendKeys "^a", TRUE WScript.Sleep 200 WshShell.SendKeys "%oca", TRUE End If