![microsoft word add in development microsoft word add in development](https://cdn.windowsreport.com/wp-content/uploads/2020/08/check-box-content-control-1.png)
![microsoft word add in development microsoft word add in development](https://vbaoverall.com/wp-content/uploads/2020/07/ab1-1.jpg)
Notice the parameters passed to the Document.Open method are all references.
#MICROSOFT WORD ADD IN DEVELOPMENT CODE#
The code above opens a document based on the file chosen in the OpenFileDialog.
![microsoft word add in development microsoft word add in development](https://i.ytimg.com/vi/hS1-3tTybXg/maxresdefault.jpg)
openFileDialog1.ShowDialog() = DialogResult.OK) // Use the open file dialog to choose a word document.private void button1_Click( object sender, System.EventArgs e).The second button creates a new document, and brings up a dialog to allow you to enter a title to the document.īelow is the code for the first button event handler: The first button opens an existing Word Document and adds a copyright line to the document. The application in this particular article is divided into two methods based on the button that is pressed in the form.
#MICROSOFT WORD ADD IN DEVELOPMENT HOW TO#
Now anything you type, open, delete, or format, will get recorded in VBA, so you have a clue how to write your Word Interoperability code. To start the macro recorder in Word, go to Tools->Macro->Record New Macro inside Microsoft Word. (Of course this is VBA code, but.close enough). So in order to jump straight over the learning curve, I simple turn the Macro Recorder on in Word and let Word write the code for me. Personally, I never want to figure the Microsoft Word code out myself, because the Word hierarchy and properties, although rich in features, has a bit of a learning curve. Now you can call the interesting methods and properties that Microsoft Word provides to you to manipulate documents in Word. private Word.ApplicationClass WordApp = new Word.ApplicationClass().