Skip to content

markbeachill/stylesweep

Repository files navigation

StyleSweep

Sweep messy Word formatting back to clean styles — without losing your bold, italics, bullets, or numbering.

StyleSweep is a Microsoft Word macro (plus a Windows installer and an optional task-pane add-in) that fixes a long-standing Word annoyance: reapplying the Normal style normally destroys formatting you want to keep. Word has a strange view of when to keep or discard bold and italic, and it happily flattens lists. StyleSweep reapplies styles carefully, so the document ends up clean and intact.

It was originally written to clean up text pasted from ChatGPT into Word, and works just as well on Markdown-to-HTML conversions (Dillinger, PanWriter, etc.) and any document where styles have drifted.

StyleSweep is a renamed and tidied-up continuation of reapply-normal by Mark Beachill. Like the original, it is public domain.

The two macros

Macro What it does
CleanText Reapplies the Normal style to every Normal-styled (or unstyled) paragraph, while preserving numbered lists, bullet points, and bold/italic at the individual word level. Paragraphs carrying outline levels 3–4 are promoted to Heading 3 / Heading 4.
CleanTextAndTables Everything CleanText does, plus tables: creates a reusable table style (StyleSweep Table) and table-text paragraph style (StyleSweep Table Text), then applies them to every table in the document — compact 8 pt text, light-grey borders, grey repeating header row, tight cell padding.

The original names ReapplyNormal and ApplyFormatting still work as aliases.

Each run is a single undo step — if you don't like the result, one Ctrl+Z puts everything back.

Get it

All downloads come from the latest release (stable links — they always serve the newest version):

Windows installer StyleSweepSetup.exe — installs the plugin for Word for Windows, replacing any older copy
Script installer install.ps1 — PowerShell alternative; -Uninstall removes it
The macro (source) StyleSweep.bas — import into Word's VBA editor (Windows & Mac)
Plugin template StyleSweep.dotm — copy into Word's STARTUP folder (the Mac route)
Task-pane add-in manifest.xml — sideload in Word on the web / desktop

Full install instructions for every route are on the website (docs/) and below.

Quick start (macro)

  1. Open Word and press Alt+F11 to open the VBA editor.
  2. File → Import File… and choose src/StyleSweep.bas (or Insert → Module and paste the file's contents).
  3. Back in Word, press Alt+F8, pick CleanText or CleanTextAndTables, and click Run.

To make it permanent, use the Windows installer, or copy a built StyleSweep.dotm into Word's STARTUP folder — see installer/README.md and addin/vba-template/README.md.

Word task-pane add-in (Office JS)

The addin/office-js folder contains a modern Word add-in with two buttons mirroring the two macros. It runs on Word for Windows, Mac, and Word on the web (Microsoft 365) — useful where macros are blocked. The task-pane app is hosted by this repository's GitHub Pages site, so no separate server is needed. See addin/office-js/README.md for sideloading instructions and known limitations (the JavaScript API can't do everything VBA can).

Which should I use? The VBA macro/plugin is the full-featured, recommended version for desktop Word. The task-pane add-in is for environments where macros are blocked or for Word on the web.

Documentation site

The docs/ folder is a ready-to-publish GitHub Pages site with explanations, downloads, installation instructions, and use cases. To publish: repository Settings → Pages → Source: Deploy from a branch → main / docs. The site appears at https://markbeachill.github.io/stylesweep/. All project URLs are already set for this repository.

Releasing

Built artifacts (the .dotm and the installer) are not kept in the repository; they're attached to GitHub Releases, and the website links to releases/latest/download/.... The short checklist — including the asset names that must stay constant — is in RELEASING.md.

Repository layout

stylesweep/
├── src/
│   └── StyleSweep.bas        The macro — import this into Word's VBA editor
├── installer/
│   ├── StyleSweep.iss        Inno Setup script → StyleSweepSetup.exe
│   ├── install.ps1           PowerShell install/uninstall alternative
│   └── README.md             How to build the .dotm and compile the installer
├── addin/
│   ├── vba-template/         Manual .dotm packaging guide
│   └── office-js/            Word task-pane add-in (manifest + docs); app lives in docs/addin/
├── docs/                     GitHub Pages site (also hosts the task-pane app)
├── RELEASING.md              Release checklist
├── CHANGELOG.md
├── CONTRIBUTING.md
└── LICENSE                   Public domain (Unlicense)

Performance note

The macro walks every word in the document twice (once to record bold/italic, once to restore it), so very large documents take a while. Screen updating is disabled during the run to speed things up. Be patient — it gets there.

Credits

Original macro and concept: Mark Beachill (reapply-normal), created to format ChatGPT output into teaching materials. Released into the public domain.

License

Public domain — see LICENSE (Unlicense). Do anything you like with it.

About

StyleSweep - reapplies normal and provides a standard table format

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors