Table of Contents
Creating a Custom Word Add-in
In this series, I want to create a custom Word Add-In and then start to build a set of REST API that are deployed as AWS Lambda functions that will allow us to Save As New, Check-Out, Check-In, Save, Release, Revise, Search and Open a word document that utilizes the AWS S3 bucket as the storage medium. Of course we will also have to create a series of database tables to manage the life-cycle of the data, and build a WPF client side application to go along with it.
In this blog we will create the Custom Word Add-in and then the following blogs will focus on each function in turn until we have a fully functioning application.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-1024x412.png)
Visual Studio Solution
The first thing we need to do is create a new Visual Studio Solution and add the following Solution Folders. This may not be the final structure but its a good start.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-1.png)
Visual Studio Project
On the Word Solution Folder, Right Mouse click and select New Project from the secondary contextual menu.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-2.png)
Select the Word VSTO Add-In project template and pick Next
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-3-1024x558.png)
Within the Project Name field key in the name of the Project, and select Create.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-5-1024x558.png)
Next we will add the Ribbon (Visual Designer), to do this Right Mouse Click on the Project and select New Item… from the secondary contextual menu.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-7-1024x758.png)
Select the Ribbon (Visual Designer) item template, then key in the name for the new item, and pick Add.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-10-1024x505.png)
Editing the Ribbon Visual Designer
To open the Ribbon Visual Designer, expand the ‘WordAddin_Project’ and then double click on the WordAddinPLM_Ribbon.vb file.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-9.png)
We can now ‘Drag and Drop’, Buttons and Menus into the ‘Group Box’, the first thing we will place into the Group Box will be a Menu.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-12.png)
Now the Menu item is placed, we can change the Label property to ‘PLM Lifecycle’.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-13.png)
Next we will expand the PLM Lifecycle menu, so we can drop Buttons and Menus into it, by Selecting the ‘Black Arrow’.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-14.png)
Repeat the process to add three Buttons and two Menu’s and rename them as shown below.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-15.png)
Then expand each of the menus adding the following buttons and again rename them.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-16.png)
Menu Images
Just to make it look a little prettier, I found a few images online for each of the menu items.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-17-1024x148.png)
To add an image to a menu item, select one of the menu items and in the properties select Imageā¦
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-18.png)
If you don’t have any image Resources, select the Import… which will open a Explorer window, where you can select an image to add to the resources. Once you have an Image Resource, you can select the resource and pick Ok.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-19.png)
You can now do this for all the menu items.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-20.png)
Button Handler Name
The last step we want to do is a little house keeping, by selecting each button we can change the Design -> Name
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-21-1024x439.png)
Once this is completed for all Buttons, double click on each button this will add the Handler to the underlying code.
Imports Microsoft.Office.Tools.Ribbon Public Class WordAddinPLM_Ribbon Private Sub WordAddinrPLM_Ribbon_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load End Sub Private Sub Btn_NewDocument_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_NewDocument.Click End Sub Private Sub Btn_SaveDocument_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_SaveDocument.Click End Sub Private Sub Btn_CloseDocument_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_CloseDocument.Click End Sub Private Sub Btn_CheckIn_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_CheckIn.Click End Sub Private Sub Btn_CheckOut_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_CheckOut.Click End Sub Private Sub Btn_Freeze_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_Freeze.Click End Sub Private Sub Btn_Release_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_Release.Click End Sub Private Sub Btn_Obsolete_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_Obsolete.Click End Sub Private Sub Btn_NewRevision_Click(sender As Object, e As RibbonControlEventArgs) Handles Btn_NewRevision.Click End Sub Private Sub WordAddinrPLM_Ribbon_Close(sender As Object, e As EventArgs) Handles Me.Close End Sub End Class
Testing
Now we have setup the Ribbon Add-On select the Start button to start debugging, this will start an instance of Word.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-22.png)
If Word does not start change the startup Project to the Word Add-in Project.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-23.png)
Once Word has started create a new Blank Document.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-24.png)
Change the active Ribbon tab to the Add-ins tab, we can now see our PLM Lifecycle Addin.
![](http://www.catiawidgets.net/wp-content/uploads/2021/05/image-25.png)
In a following Blog well start, to flesh out the rest of the project.