Set author to word document in vb.net

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:

Microsoft.office.Core
Microsoft.Office.Interop.Word

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.
Thanks