I have written an add in for Excel in VBA, but I would now like to convert it to VB.Net. I have been looking at VB.net tutorials and I read this but I am still confused on getting started.
I have started a new Excel Add-In Project and have this code:
Public Sub Test1()
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet = oBook.Worksheets(1)
oSheet.Cells(1, 1) = "HEY!"
End Sub
This starts up Excel in a new window and I get the standard Excel new worksheet or template prompt, and when I choose blank workbook the "HEY!" does not appear.
Also, I want this to be an add in that works with the current active sheet, not starting a new one. Am I going about this wrong?
Edit: I don't see how this question is too broad tbh. I have provided code that I have basically copied from a tutorial and said exactly what the code is doing, and what it should be doing. Its certainly a beginner question, but not too broad imo. Please let me know what I can do to fix it.
VSTO
(Visual Studio Tools for Office) – me how May 29 at 7:09