Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 15
Default Error trying to close down dbase IV file used for input to excel

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Error trying to close down dbase IV file used for input to excel

Windows(Filename).Activate

Can't have the path included:

Filename = "export.dbf"
Windows(Filename).Activate

may work ok.



don wrote:

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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save an excel file to dBase format? rdonohue Excel Discussion (Misc queries) 2 March 28th 09 12:22 AM
why excel 2007 does not support dbase file type? InuyashaTSL Excel Discussion (Misc queries) 2 February 20th 08 05:11 PM
How to Export datas from Excel cells to another excel/dbase file viraj Excel Discussion (Misc queries) 2 June 11th 07 10:55 PM
Saving Excel file in DBase IV format CrawdadSolstice Excel Discussion (Misc queries) 9 March 20th 06 10:39 PM
Issues with opening DBF (dBase) file in Excel EuroMaverick Excel Discussion (Misc queries) 1 February 15th 06 04:15 PM


All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"