excel file is locked

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,
After importing an excel file, using the following code,
the excel file is locked and can open it Read Only.

Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
Set xlWkb = xlApp.Workbooks.Open("C:\ImportData\" & v_flie_name & ".xls")
Set xlSht = xlWkb.Sheets(1)
Set xlRng = xlSht.Cells(v_row, v_column)
xlWkb.Close

Do you have any ideas why is this happened?
thanks.
 
In
SIN said:
Hi ,
After importing an excel file, using the following code,
the excel file is locked and can open it Read Only.

Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
Set xlWkb = xlApp.Workbooks.Open("C:\ImportData\" & v_flie_name &
".xls") Set xlSht = xlWkb.Sheets(1)
Set xlRng = xlSht.Cells(v_row, v_column)
xlWkb.Close

Do you have any ideas why is this happened?
thanks.

I'm not sure, but try releasing all the objects you created:

xlWkb.Close

Set xlRng = Nothing
Set xlSht = Nothing
Set xlWkb = Nothing
Set xlApp = Nothing
 
Back
Top