View Single Post
  #5 (permalink)  
Old June 2nd, 2010, 01:02 AM
caveatashish caveatashish is offline
Registered User
Join Date: Dec 2005
Location: Hyderabad, Andhra Pradesh, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to caveatashish Send a message via Yahoo to caveatashish
Default Close the file

Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet

xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("c:\test1.xlsx")
xlWorkSheet = xlWorkBook.Worksheets("sheet1")

once you are done with the excel file don't forget to close the file, otherwise it will give an error if you try to open that excel file again either through code or manually

Reply With Quote