I
I
Igor Kaspersky2016-02-14 23:24:48
Visual Basic
Igor Kaspersky, 2016-02-14 23:24:48

Visual Studio 2015, vb.net how to deal with this problem?

I want to make an Excel document and edit it, but this error appears, what should I do?

Dim fileTest As String = "C:\Users\Documents\Visual Studio 2015\Projects\test.xlsx"
        If File.Exists(fileTest) Then
            File.Delete(fileTest)
        End If

        Dim oExcel As Object
        oExcel = CreateObject("Excel.Application")
        Dim oBook As Excel.Workbook
        Dim oSheet As Excel.Worksheet

        oBook = oExcel.Workbooks.Add
        oSheet = oExcel.Worksheets(1)

        oSheet.Name = "бла бла бла"
        oSheet.Rang("A1").Value = "Что-то"
        oBook.SaveAs(fileTest)
        oBook.Close()
        oBook = Nothing
        oExcel.Quit()
        oExcel = Nothing

47ec48e147a4454e98b55506408bce65.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question