Excel的應用需要加入參考,這方面可以參考:[Excel] 新增/刪除 工作表
程式碼最上面引用
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop
Shell(pathname,windowstyle)
My.Computer.FileSystem.DeleteFile("C:\VB.txt", FileIO.UIOption.AllDialogs, FileIO.RecycleOption.DeletePermanently, FileIO.UICancelOption.DoNothing)