Advertisement
stevennathaniel

VB .NET : Berhasil Buka File Excel Tanpa Jejak

Jan 21st, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.94 KB | None | 0 0
  1. Imports Excel = Microsoft.Office.Interop.Excel
  2.  
  3. Imports Microsoft.Office
  4.  
  5. Public Class Form8
  6.  
  7.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  8.  
  9.         Dim appXL As Excel.Application = Nothing
  10.  
  11.         Dim wbXL As Excel.Workbook = Nothing
  12.  
  13.         Dim wbXLs As Excel.Workbooks = Nothing
  14.  
  15.         Dim shXL As Excel.Worksheet = Nothing
  16.  
  17.         Dim shXLs As Excel.Worksheets = Nothing
  18.  
  19.         Dim raXL As Excel.Range = Nothing
  20.  
  21.  
  22.         appXL = New Excel.Application
  23.  
  24.         wbXL = appXL.Workbooks.Open("D:\fileExcel\Latihan100.xlsx")
  25.  
  26.         appXL.Visible = True
  27.  
  28.         shXL = wbXL.Worksheets("Sheet1")
  29.  
  30.  
  31.         appXL.UserControl = True
  32.  
  33.  
  34.         raXL = Nothing
  35.  
  36.         wbXL = Nothing
  37.  
  38.         shXL = Nothing
  39.  
  40.         appXL = Nothing
  41.  
  42.  
  43.         Exit Sub
  44.  
  45.  
  46. Err_Handler:
  47.  
  48.         MsgBox(Err.Description, vbCritical, "Error: " & Err.Number)
  49.  
  50.     End Sub
  51. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement