Hi. In VB6 I can declare excel components globally in a VB module then call it in the Form:
In VB.NET I tried this:
Should this be in a public class or a module?
I tested my code by placing one button on the form to CREATE_EXCEL.
This caused an error since the private button routine did not "see" that Excel does exist.
How do I setup MS Excel globally so that any private sub can access it? By the way, I had already added the reference to Excel library.
If possible, please attach short code.
VB.NET:
Public Sub Setup_MSEXCEL()
Set xlApp = New Excel.Application
Set xlWB = xlApp.Workbooks.Add
Set xlWS = xlWB.Worksheets("sheet1")
In VB.NET I tried this:
VB.NET:
Dim XL as Excel.Application
Dim WB as Excel.Workbook
Dim Sheet as Excel.Worksheet
Should this be in a public class or a module?
I tested my code by placing one button on the form to CREATE_EXCEL.
This caused an error since the private button routine did not "see" that Excel does exist.
How do I setup MS Excel globally so that any private sub can access it? By the way, I had already added the reference to Excel library.
If possible, please attach short code.