Copy code from Visual Studio Code and paste it into Outlook with language syntax colors and formatting intact.
Features
- Highlights the selected code for its VS Code language and uses an Outlook-safe light or dark palette.
- Places explicit Windows CF_HTML and plain-text formats on the clipboard for reliable Outlook pasting.
- Copies selected text only—use Select All first when you intentionally want the complete file.
- Works in untrusted and virtual workspaces because it does not execute workspace code.
- Sends no telemetry and makes no network requests.
Use it
- Select code in the editor.
- Press
Ctrl+Alt+C on Windows/Linux or Cmd+Alt+C on macOS.
- Paste normally into an HTML-format Outlook message with
Ctrl+V or Cmd+V.
You can also right-click in the editor and choose Copy Selected Code for Outlook (HTML), or run this command from the Command Palette:
- Outlook Code: Copy Selected Code for Outlook (HTML)
Outlook paste setting
If Outlook removes the colors, choose Keep Source Formatting from its paste options. In classic Outlook for Windows, the default can be set under File > Options > Mail > Editor Options > Advanced > Cut, copy, and paste > Pasting from other programs.
Microsoft documents this behavior in Outlook Editor options.
Color behavior
The extension detects whether the active VS Code theme is light or dark and creates a matching Outlook-safe code block with inline syntax colors. Inline styles are used because Outlook may remove stylesheet classes when pasting.
The destination application still controls its final paste behavior. If Outlook offers a paste option, choose Keep Source Formatting.
Setting
outlookCodeFormatCopier.showConfirmation controls the short status-bar message shown after a copy. It defaults to true.
Privacy and security
The extension reads only the text you select. On Windows, it uses a local PowerShell clipboard helper to place HTML and plain text on the clipboard. It does not read unrelated files, execute workspace programs, contact external services, or collect telemetry.
Requirements
- Windows 10 or 11
- Visual Studio Code 1.85 or newer
- An Outlook message composed in HTML format
Test locally before publishing
- Open this project folder in VS Code.
- Run
npm install, then npm test in the integrated terminal.
- Press
F5 and choose Run Extension if VS Code asks for a launch configuration.
- In the Extension Development Host window, open a code file and select only a few lines.
- Press
Ctrl+Alt+C, then paste normally into a new Outlook message composed as HTML.
- Confirm that the colors are present and that the pasted text exactly matches the selection, with no unselected text added.
- To test the complete file intentionally, press
Ctrl+A before Ctrl+Alt+C.
You can also build and install the exact local package:
npm run package:vsix
code --install-extension .\outlook-code-format-copier-1.1.0.vsix --force
Reload VS Code after installing the VSIX.
Support
The packaged extension includes SUPPORT.md with troubleshooting and issue-report details.
License
MIT