I'm trying to change the cell's value on excel but I get this error (System.Runtime.InteropServices.COMException: '0x800A03EC') when I run this part of the code
Private Sub SaveHeaderBut_Click(sender As Object, e As EventArgs) Handles SaveHeaderBut.Click
objSheet = objBook.Sheets("Header")
objSheet.Cells("5", "9").value = ExCountry_txt.Text
objSheet.Cells("5", "10").value = ExCoName_txt.Text
objSheet.Cells("5", "11").value = ExCoAddress_txt.Text
This part of the code is in a different form and the function that opens the excel application is in a module
Module Module1
Public objApp As Excel.Application
Public objBook As Excel._Workbook
Public objBooks As Excel.Workbooks
Public objSheets As Excel.Sheets
Public objSheet As Excel._Worksheet
Public range As Excel.Range
Public Sub Criarligação()
objApp = CreateObject("Excel.Application")
objApp.DisplayAlerts = True
objApp.Visible = False
'Clean up a little.
range = Nothing
objSheet = Nothing
objSheets = Nothing
objBooks = Nothing
End Sub
To get to form2 I'm using this sub
Private Sub NewFileToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NewFileToolStripMenuItem.Click
Dim template = "C:\Tabelasdexpedição\Template"
Criarligação()
objBook = objApp.Workbooks.Open(template)
Dim fr2 As New Form2
fr2.Show()
I'm asking for help because I cant understand the error message nor what's creating it.