I'm trying to create an Excel Add-in that consists on a new ribbon tab with custom buttons.
I would like that, for example, when I click on a button on the ribbon, to write something to an already open Excel sheet, like the code that I show below, but with this code, I get the error that I show on the attached picture.
What am I missing here?
Public Class Ribbon1
Private Sub btnInserirLinha_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles btnInserirLinha.Click
Dim objExcelApp As New Excel.Application
Dim objExcelBook As Excel.Workbook
Dim objExcelSheet As Excel.Worksheet
objExcelBook = objExcelApp.ActiveWorkbook
objExcelSheet = objExcelBook.ActiveSheet
objExcelSheet.Cells(1, 1) = "Teste"