In this article we will discuss read and rewrite or update author of any word document in vb.net.
Every word document has some inbuilt properties and custom properties such as Title, subject, category, Author, comments etc.
we need to add the following reference in your project:
And you can use the following code snippt to set the author of the word document.
Private Sub SetAuthor(ByVal Docpath As String, ByVal AuthorName As String) Dim Wapp As New Microsoft.Office.Interop.Word.Application Dim docWord As New Microsoft.Office.Interop.Word.Document docWord = Wapp.Documents.Open(Docpath) Dim _BuiltInProperties As Object = docWord.BuiltInDocumentProperties If Not _BuiltInProperties Is Nothing Then _BuiltInProperties("Author").Value = AuthorName End If docWord.Close() Wapp = Nothing End Sub
I you face any problem during code implementation, let me know.