Imports Statement (.NET Namespace and Type) – Use of aliases
Use of aliases can save your precious time.
Imports Microsoft.Office.Interop.Excel
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oXL As Microsoft.Office.Interop.Excel.Application
oXL = New Microsoft.Office.Interop.Excel.Application
can be changed to
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oXL As Excel.Application
oXL = New Excel.Application
Saves a lot of typing and more concise.
No comments:
Post a Comment