Following code works well.
Option Strict Off
Imports Microsoft.Office.Interop
Public Class Form1
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim xlApp As Excel.Application = Nothing
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlApp.WindowState = Excel.XlWindowState.xlMinimized
Dim wb1 As Excel.Workbook
wb1 = xlApp.Workbooks.Open("C:\MyFolder\Book1.xlsx")
With CType(wb1.Sheets(1), Excel.Worksheet)
.Columns(4).Cut()
.Columns(2).Insert()
End With
End Sub
End Class
When I turn Option Strict on then error happens. Thanks in advance. Have a nice day.