#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Kill a file

I tried to use the following code for killing file which already
exists. The process is stuck at the second file that is available in
the dir, but the program is not able to find that file, The control
moves from Kill "C:\Temp\asptbkt.jrst" to Error and resumes with
err.number 55.. This is creating a lot of chaos in my program.


On Error GoTo errorhandler
Kill "C:\Temp\asptnozzle.jrst"
Kill "C:\Temp\asptbkt.jrst"
Kill "C:\Temp\asptclearance.jrst"
Kill "C:\Temp\asptbalancehole.jrst"

' CLEAR THE SCREEN
Screen_Mopping ' calling Screen Clear subroutine

THRUST_Click ("asptnozzle.edi") ' calling ASPL subroutine for Nozzle
Data

THRUST_Click ("asptbkt.edi")
THRUST_Click ("asptclearance.edi")
THRUST_Click ("asptbalancehole.edi")

errorhandler:
Select Case Err.Number
Case 53
Resume Next
Case 55 ' "File already open" error.
Close #1 ' Close open file.
Resume
End Select


Can anyone solve this puzzle

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Kill a file

I think I'd try to find out why that file is open.

Did you open it in any of your code? Do you have another application/process
running that's using it?

Maybe that other program hasn't finished with it????

Gautam wrote:

I tried to use the following code for killing file which already
exists. The process is stuck at the second file that is available in
the dir, but the program is not able to find that file, The control
moves from Kill "C:\Temp\asptbkt.jrst" to Error and resumes with
err.number 55.. This is creating a lot of chaos in my program.

On Error GoTo errorhandler
Kill "C:\Temp\asptnozzle.jrst"
Kill "C:\Temp\asptbkt.jrst"
Kill "C:\Temp\asptclearance.jrst"
Kill "C:\Temp\asptbalancehole.jrst"

' CLEAR THE SCREEN
Screen_Mopping ' calling Screen Clear subroutine

THRUST_Click ("asptnozzle.edi") ' calling ASPL subroutine for Nozzle
Data

THRUST_Click ("asptbkt.edi")
THRUST_Click ("asptclearance.edi")
THRUST_Click ("asptbalancehole.edi")

errorhandler:
Select Case Err.Number
Case 53
Resume Next
Case 55 ' "File already open" error.
Close #1 ' Close open file.
Resume
End Select

Can anyone solve this puzzle


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Kill a file

On Aug 13, 4:59 pm, Dave Peterson wrote:
I think I'd try to find out why that file is open.

Did you open it in any of your code? Do you have another application/process
running that's using it?

Maybe that other program hasn't finished with it????





Gautam wrote:

I tried to use the following code for killing file which already
exists. The process is stuck at the second file that is available in
the dir, but the program is not able to find that file, The control
moves from Kill "C:\Temp\asptbkt.jrst" to Error and resumes with
err.number 55.. This is creating a lot of chaos in my program.


On Error GoTo errorhandler
Kill "C:\Temp\asptnozzle.jrst"
Kill "C:\Temp\asptbkt.jrst"
Kill "C:\Temp\asptclearance.jrst"
Kill "C:\Temp\asptbalancehole.jrst"


' CLEAR THE SCREEN
Screen_Mopping ' calling Screen Clear subroutine


THRUST_Click ("asptnozzle.edi") ' calling ASPL subroutine for Nozzle
Data


THRUST_Click ("asptbkt.edi")
THRUST_Click ("asptclearance.edi")
THRUST_Click ("asptbalancehole.edi")


errorhandler:
Select Case Err.Number
Case 53
Resume Next
Case 55 ' "File already open" error.
Close #1 ' Close open file.
Resume
End Select


Can anyone solve this puzzle


--

Dave Peterson- Hide quoted text -

- Show quoted text -


i tried to find if the file is open, and what i did was to close all
the files that were open by using "close". This worked.

Thanks for your attention

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
Kill file EW Excel Programming 4 August 29th 06 09:36 AM
Kill file EW Excel Programming 8 August 17th 06 03:32 AM
Kill a File Posse John Excel Programming 2 August 4th 06 02:23 PM
Kill Michael Excel Programming 2 August 23rd 05 11:53 AM
File kill help Marino13[_6_] Excel Programming 0 February 19th 04 01:40 PM


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

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

About Us

"It's about Microsoft Excel"