excel file is locked

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.
 
D

Dirk Goldgar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top