https://github.com/analyticsinmotion/add-chatgpt-to-microsoft-word
How to add ChatGPT's Text Completion to Microsoft Word
https://github.com/analyticsinmotion/add-chatgpt-to-microsoft-word
analytics-in-motion chatgpt chatgpt-awesome chatgpt-in-ms-word chatgpt-in-word chatgpt-text-completion microsoft-word text-completion text-davinci-003 vba vba-word
Last synced: about 1 month ago
JSON representation
How to add ChatGPT's Text Completion to Microsoft Word
- Host: GitHub
- URL: https://github.com/analyticsinmotion/add-chatgpt-to-microsoft-word
- Owner: analyticsinmotion
- License: mit
- Created: 2023-02-06T02:41:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-01T14:15:07.000Z (over 1 year ago)
- Last Synced: 2025-03-22T16:52:50.612Z (about 2 months ago)
- Topics: analytics-in-motion, chatgpt, chatgpt-awesome, chatgpt-in-ms-word, chatgpt-in-word, chatgpt-text-completion, microsoft-word, text-completion, text-davinci-003, vba, vba-word
- Language: VBA
- Homepage: https://www.analyticsinmotion.com
- Size: 1.69 MB
- Stars: 97
- Watchers: 4
- Forks: 25
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-chatgpt - Add ChatGPT to Microsoft Word - How to integrate ChatGPT with Microsoft Word. (Integrations / Examples)
- awesome-chatgpt - Add ChatGPT to Microsoft Word - How to integrate ChatGPT with Microsoft Word. (Integrations / Examples)
- awesome-gpt - add-chatgpt-to-microsoft-word
- awesome-chatgpt - analyticsinmotion/add-chatgpt-to-microsoft-word - This project enables users to add ChatGPT's text completion functionality directly into Microsoft Word through a VBA script and custom ribbon button, allowing AI-powered text generation within the Word environment. (Addons, extensions, plug-ins for integrating LLM into third-party applications / Other user interfaces)
README
# :dark_sunglasses: Add ChatGPT to Microsoft Word [](https://twitter.com/intent/tweet?text=How%20to%20add%20ChatGPT's%20Text%20Completion%20functionality%20to%20Microsoft%20Word.&url=https://github.com/analyticsinmotion/add-chatgpt-to-microsoft-word&via=analyticsmotion&hashtags=chatgpt,openai,Microsoft365,davinci)
How to add ChatGPT's Text Completion functionality to Microsoft Word.
| | |
| --- | --- |
| Powered by | [](https://chat.openai.com)  |
| Meta | [](https://github.com/analyticsinmotion/chatgpt-images-r-shiny/blob/main/LICENSE.md)    |
| Testing | [](https://github.com/analyticsinmotion/add-chatgpt-to-microsoft-word/actions/workflows/blank.yml) |
| Orgs | [](https://www.microsoft.com) [](https://openai.com) [](https://www.analyticsinmotion.com) |## 1. Description
With the click of a single button you can access ChatGPT's awesome natural language capabilies in Microsoft Word
https://user-images.githubusercontent.com/52817125/218468803-5cdfbda3-4a5f-4d74-aaec-2a136e9b7956.mp4
## 2. Getting Started
### 2.1 Dependencies
- Requires an OpenAI API Key (create an account and get API Key at https://chat.openai.com)
- Requires Microsoft Windows 10/11 (https://www.microsoft.com/en-au/windows)
- Requires Microsoft Word 365 (https://www.microsoft.com/en-us)Please be aware of the [costs](https://openai.com/pricing) associated with using the OpenAI API when utilizing this project.
## 3. Instructions
- Write the text you want to send to ChatGPT anywhere in Microsoft Word
- Click the Text Completion button in the AI Assistant tab
- Wait a few seconds for ChatGPT to respond
- The text completion results will appear under initial request text### 3.1 Text Completion Example 1
User Input
```
What are the benefits of generative AI models?
```ChatGPT Output
![]()
### 3.2 Text Completion Example 2
User Input
```
Are aliens real?
```ChatGPT Output
![]()
## 4. Installation
There are 4 basic steps in order to add a ChatGPT button into Microsoft Word:
1. Enable the Developer Tab
2. Import the VBA script file
3. Create the ChatGPT button
4. Add your OpenAI APIKeyEach of these steps are fully outlined below.
### 4.1 Enable the Developer Tab
The Developer tab isn't displayed by default, but you can add it to the ribbon.
**Step 1** - On the File tab, go to Options > Customize Ribbon.
**Step 2** - Under Customize the Ribbon and under Main Tabs, select the Developer check box.
![]()
The latest instructions to enable the Developer Tab from Microsoft can be found here:
https://support.microsoft.com/en-us/office/show-the-developer-tab-in-word-e356706f-1891-4bb8-8d72-f57a51146792### 4.2 Import the ChatgptTextCompletion.bas file
**Step 1** - Download and Save the latest ChatgptTextCompletion.bas file from this repository.
Keep the location of where the file is saved as you will need it later.
**Step 2** - On the Developer tab, click the Visual Basic button.
![]()
**Step 3** - On the File tab, go to Import File...
![]()
**Step 4** - Select the ChatgptTextCompletion.bas file and click Open
### 4.3 Add your ChatGPT button into the Microsoft Word Ribbon
**Step 1** - Add a new tab
- On the File tab, go to Options > Customize Ribbon
- Click New Tab
![]()
**Step 2** - Rename the New Tab to **AI Assistant**
![]()
**Step 3** - Rename New Group (Custom) to **ChatGPT**
![]()
**Step 4** - Select Macros in the Choose Commands from dropdown box
![]()
**Step 5** - Select the ChatgptTextCompletion Macro and click Add >>
![]()
**Step 6** - Rename button to **Text Completion**, select a Symbol and click OK
![]()
After the preceding steps have been completed the Microsoft Word screen should look like the following:
![]()
### 4.4 Add your OpenAI APIKey into Windows
**Step 1** - Open the Start menu and start typing "environment variables". When the best match appears click "Edit the system environment variables" result.
![]()
**Step 2** - Click the "Environment variables" button under the "Advanced" tab.
![]()
**Step 3** - Create a new user variable by clicking "New" under the "User Variables" section.
![]()
**Step 4** - Type the variable name **OPENAI_API_KEY** in the first field and your OpenAI APIKEY in the variable value field. Then click OK.
![]()
**Step 5** - **IMPORTANT** You must restart Windows to apply the new environment variable
## 5. Best Practices for API Key Safety
Your OpenAI APIKEY key/s should be kept secure and private at all times.
Please follow the best practices guide for API security from OpenAI
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
## 6. Related Projects
This repository closely relates to two of our other projects:
- **Add GPT Chat to Microsoft Word** - Create a powerful chatbot in Microsoft Word using ChatGPT
More information on this project can be found at https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word
- **Create Images with DALL·E in Microsoft Word** - How to add OpenAI's Image Generation capability (DALL·E 2) to Microsoft Word
More information on this project can be found at https://github.com/analyticsinmotion/create-images-with-dall-e-in-microsoft-word