Getting late binding error

author = CType(workBook. BuiltinDocumentProperties(“Last saved by”). Value, String) : here I’m getting late binding error

Attaching my full code here:

Dim excelApp As New Application

Dim workBook As Workbook = excelApp.Workbooks.Open(FilePath)

author = Clype(workBook. BuiltinDocumentProperties(“Last saved by”). Value, String)

Console. WriteLine("Author: " , author)

workBook.Close(False)

excelApp. Quit

ReleaseComObject(workBook)

ReleaseComObject(excelApp)

End Sub

Private Sub ReleaseComObject(ByVal obj As Object)

Try

If obj IsNot Nothing Then

Marshal.ReleaseComObject(obj)

End If

Catch ex As Exception

  • Handle the exception, if needed

Finally

obj = Nothing

End Try

Please help if anyone knows about vb.net code

@Ambika_Singh1

try this

Dim author As String = Ctype(workBook. BuiltinDocumentProperties("Last saved By"). Value, String)

cheers

Hey @Ambika_Singh1
Try this:

Dim excelApp As New Application
Dim workBook As Workbook = excelApp.Workbooks.Open(FilePath)

Dim author As String = CType(workBook.BuiltinDocumentProperties("Last saved by").Value, String)

Console.WriteLine("Author: ", author)

workBook.Close(False)
excelApp.Quit()

ReleaseComObject(workBook)
ReleaseComObject(excelApp)

Hi thanks for the reply, but i have already initialised author variable in arguments and I’m passing that in this code.

And also, i have tried doing this either ways still i’m getting this issue

Hi everyone,

I got the solution. Here the is link of the youtube video.

Thanks,
Ambika

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.