ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing a db file getting errors (https://www.excelbanter.com/excel-programming/362484-closing-db-file-getting-errors.html)

don

Closing a db file getting errors
 
I am getting errors trying to close down a dbase file.
In the code below:
at the line Windows(filename).activate
I get a Run-time error '9' subscript out of range.
I think that is because windows only works on .xls files but that is
only a guess on my part.
at the line Filename.Delete
I get a run-time error '424' subscript out of range.
I beleive somehow I need to close the file before deleting it.
Thanks in advance for any help.
Don


Workbooks.Open Filename:="C:\My Documents\export.dbf"
Filename = "C:\My Documents\export.dbf"
' do stuff here
Application.DisplayAlerts = False
Windows(Filename).Activate ' Close down imported file before exiting
ActiveWorkbook.Close
Application.DisplayAlerts = True
Filename.Delete


All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com