Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Const WM_SYSCOMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
Dim oExcel As New Excel.Application
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Panel1.Dock = DockStyle.Fill
Dim sExcelFileName = "C:\Users\Sixsigma\Desktop\notepad\Book1.xlsx"
oExcel.DisplayAlerts = False
oExcel.Workbooks.Open(sExcelFileName)
'oExcel.Application.WindowState = Excel.XlWindowState.xlMaximized
oExcel.Visible = True
SetParent(oExcel.Hwnd, Panel1.Handle)
SendMessage(oExcel.Hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
End Sub