I am trying to create an add-in for a word that preserves open documents. I put the ribbon and button on it. Below is the code [button click handler] that I use to save a text document in a specific place:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles Button1.Click
Dim ThisApplication As Word.Application
ThisApplication.ActiveDocument.SaveAs("C:\email")
ThisApplication.Quit()
ThisApplication= Nothing
End Sub
But when I click on this button, I create email.doc, but this document does not contain any contents of the open document; it just creates a new document file.
What am I doing wrong? The event handler on this button should behave the same as the event handler on the standard Word save button, so how can I do this?
source
share