Solved Desktop shortcut to end MS Word


SoFine409

Well-known member
VIP
Local time
4:36 AM
Posts
60
OS
Windows 11 Pro
At the end of each working session, I use FreeFileSync to create a quick backup of any new, deleted, or changed files. And yes, I do use Macrium to create images but not every day. The problem is that if I've used Outlook to check my email and have used MS Word to view or edit a document then FreeFileSync will not be able to synchronize some of Outlooks files in AppData. I can fix this either by restarting or by opening Task Manager and ending Microsoft Word. So, to save time I'd like to have shortcut on my desktop that I could single click to end MS Word. If someone could help with this I'd be very grateful.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell 8940 XPS
    CPU
    10th Gen Intel(R) Core(TM) i7-10700, 2.90GHz
    Motherboard
    Dell 0KV3RP (U3E1)
    Memory
    32GB, 2x16GB, DDR4, 2933Mhz
    Graphics Card(s)
    NVIDIA(R) GeForce(R) RTX 2060 SUPER(TM) 8GB GDDR6
    Sound Card
    Onboard, Realtek Codec, NVIDIA Hi Def Audio, Intel Display Audio
    Monitor(s) Displays
    Dell UltraSharp U3415W
    Screen Resolution
    3440x1440
    Hard Drives
    2TB M.2 PCIe NVMe SSD; 2TB Samsung SSD 860 EVO; 2TB Samsung SSD 860 EVO 2
    PSU
    500 W Dell
    Case
    Night Sky Bezel Chassis
    Cooling
    Dell
    Keyboard
    Logi Wireless
    Mouse
    Logi Wireless
    Internet Speed
    111 Mbps Download, 132 Mbps Upload
    Browser
    Edge, Chrome
    Antivirus
    Windows Defender, MalwareBytes
  • Operating System
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Falcon Northwest Talon
    CPU
    Intel 13900K Core I9 24 Core LGA 1700
    Motherboard
    Asus ROG Z970 Maximus Hero
    Memory
    32GB (2x16) Kingston Fury Beast 6000MHZ DDR5
    Graphics card(s)
    nVidia 4090 Founders Edition
    Sound Card
    Motherboard
    Monitor(s) Displays
    Alienware 34” Curved OLED
    Screen Resolution
    4K
    Hard Drives
    SSD M.2 Kingston Renegade Fury 4 TB x 2; Western Digital Red Pro 8 TB SATA III
    PSU
    1000W ECGA Platinum Modular ATX
    Case
    Falcon NW Custom
    Cooling
    AIO Falcon NW 280mm Liquid Cooler
    Mouse
    Logitech G502
    Keyboard
    Logitech Pro Gamer
    Internet Speed
    111 Mbps Download, 132 Mbps Upload
    Browser
    Edge, Chrome
    Antivirus
    Windows Defender, MalwareBytes
    Other Info
    Noise Blocker Fans
@SoFine409 I'm far from being any kind of coder but I found this online

Code:
taskkill /IM winword.exe /f

Copy to notepad, save as .bat

Worked for me.
 

My Computers

System One System Two

  • OS
    Win 11 Pro 23H2 22631.3527
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self Built
    CPU
    Intel® Core™ i7-14700F
    Motherboard
    ASUS TUF GAMING Z690-PLUS WIFI
    Memory
    G.SKILL Ripjaws S5 Series 64GB (2 x 32GB) DDR5
    Graphics Card(s)
    EVGA GeForce RTX 3050 XC Black Gaming
    Sound Card
    Sound Blaster AE-5 Plus
    Monitor(s) Displays
    ASUS TUF Gaming 27" 2K HDR Gaming
    Screen Resolution
    2560 x 1440
    Hard Drives
    Samsung 990 Pro 1TB NVMe (Win 11)
    SK hynix P41 500GB NVMe (Win 10)
    SK hynix P41 2TB NVMe (x3)
    Crucial P3 Plus 4TB
    PSU
    Corsair RM850x Shift
    Case
    Antec Dark Phantom DP502 FLUX
    Cooling
    Noctua NH-U12A chromax.black + 7 Phantek T-30's
    Keyboard
    Logitech MK 320
    Mouse
    Razer Basilisk V3
    Internet Speed
    350Mbs
    Browser
    Firefox
    Antivirus
    Winows Security
    Other Info
    Windows 10 22H2 19045.4291
    On System One
  • Operating System
    Win 11 Pro 23H2 22631.3527
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self Built
    CPU
    Intel Core i7-11700F
    Motherboard
    Asus TUF Gaming Z590 Plus WiFi
    Memory
    64 GB DDR4
    Graphics card(s)
    EVGA RTX 2060 KO Ultra Gaming
    Sound Card
    SoundBlaster X-Fi Titanium
    Monitor(s) Displays
    Samsung F27T350
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 980 Pro 1TB
    Samsung 970 EVO Plus 2TB
    Samsung 870 EVO 500GB SSD
    PSU
    Corsair HX750
    Case
    Cougar MX330-G Window
    Cooling
    Hyper 212 EVO
    Internet Speed
    350Mbps
    Browser
    Firefox
    Antivirus
    Windows Security
This script is more polite in taking the time to save updated Word docs, before exiting Word.

The exception is any new docs you've created, but never saved to a folder. I'm assuming since you didn't care to give them filenames, you don't want them saved. Other docs which are already saved won't mind being closed.

1. Open Notepad, copy this script to CloseWordDocs.vbs
Code:
Dim objWord, objDoc, status

On Error Resume Next
Do
    Set objWord = GetObject(, "Word.Application")
    status = Err.Number

    If status = 0 Then
        For Each objDoc in objWord.Documents
            'WScript.Echo objDoc.Name
            If objDoc.Saved = False Then
                If Instr(objDoc.FullName,".doc") > 0 Then
                    'WScript.Echo "Saving " + objDoc.FullName
                    objDoc.Save
                Else
                    objDoc.Close False
                End If
            End If
        Next
        objWord.Quit
        Set objWord = Nothing
    End If
Loop Until status = 429

On Error Goto 0

2. Create a desktop shortcut from the script.
3. Rename it. Change the Icon if you want to one of the Word icons under \Program Files\Office...\... [depends on your Office version].
4. Click shortcut to close all Word windows.

If you have a scheduled task that runs FreeFileSync, create another task to run this script a few minutes before your sync takes place.
 
Last edited:

My Computer

System One

  • OS
    Windows 7
@Scott @garlin
Thank you both for you answers. I've created the desktop files and I'll test them later today when I get a few minutes.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell 8940 XPS
    CPU
    10th Gen Intel(R) Core(TM) i7-10700, 2.90GHz
    Motherboard
    Dell 0KV3RP (U3E1)
    Memory
    32GB, 2x16GB, DDR4, 2933Mhz
    Graphics Card(s)
    NVIDIA(R) GeForce(R) RTX 2060 SUPER(TM) 8GB GDDR6
    Sound Card
    Onboard, Realtek Codec, NVIDIA Hi Def Audio, Intel Display Audio
    Monitor(s) Displays
    Dell UltraSharp U3415W
    Screen Resolution
    3440x1440
    Hard Drives
    2TB M.2 PCIe NVMe SSD; 2TB Samsung SSD 860 EVO; 2TB Samsung SSD 860 EVO 2
    PSU
    500 W Dell
    Case
    Night Sky Bezel Chassis
    Cooling
    Dell
    Keyboard
    Logi Wireless
    Mouse
    Logi Wireless
    Internet Speed
    111 Mbps Download, 132 Mbps Upload
    Browser
    Edge, Chrome
    Antivirus
    Windows Defender, MalwareBytes
  • Operating System
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Falcon Northwest Talon
    CPU
    Intel 13900K Core I9 24 Core LGA 1700
    Motherboard
    Asus ROG Z970 Maximus Hero
    Memory
    32GB (2x16) Kingston Fury Beast 6000MHZ DDR5
    Graphics card(s)
    nVidia 4090 Founders Edition
    Sound Card
    Motherboard
    Monitor(s) Displays
    Alienware 34” Curved OLED
    Screen Resolution
    4K
    Hard Drives
    SSD M.2 Kingston Renegade Fury 4 TB x 2; Western Digital Red Pro 8 TB SATA III
    PSU
    1000W ECGA Platinum Modular ATX
    Case
    Falcon NW Custom
    Cooling
    AIO Falcon NW 280mm Liquid Cooler
    Mouse
    Logitech G502
    Keyboard
    Logitech Pro Gamer
    Internet Speed
    111 Mbps Download, 132 Mbps Upload
    Browser
    Edge, Chrome
    Antivirus
    Windows Defender, MalwareBytes
    Other Info
    Noise Blocker Fans

Latest Support Threads

Back
Top Bottom