Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7751641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:36:02+00:00 2026-06-01T11:36:02+00:00

I am investigating a problem with an old VB6 app which has just started

  • 0

I am investigating a problem with an old VB6 app which has just started happening on the dedicated XP machine it runs on. The application processes email messages and for each items it writes a file to a local directory, passes the file path to another function for processing then deletes the file via a Kill command.

It all seems to work until an error occurs during processing. The error handler has no explicit Kill or DeleteFile in it, the error is just handled and processing continues with the next message. As soon as that occurs, the CreateTextFile method fails for every subsequent item with a ‘Permission denied’ error as the file already exists (even though the CreateTextFile call passes True for overwrite).

I have tried various things, most notably putting Kill, FSO.DeleteFile or a call to the DeleteFile API in the error handler, yet none of these work (first two fail with permission denied, the API doesn’t error but doesn’t delete the file either).

I’ve installed Unlocker on the machine and the only process with a lock on the file is the application in question. Filemon reports a ‘sharing violation’ on the file following an ‘IRP_MJ_CREATE’ as soon as the problem occurs so I guess this might be pointing to the issue but I cannot see what the problem actually is.

The simplified code is as follows:

Do While objMessages.Count > 0
    Set fsObj = CreateObject("Scripting.FileSystemObject")
    Set tsObj = fsObj.CreateTextFile("C:\Temp\MyFile.txt", True)
    ...
    tsObj.Close
    Set tsObj = Nothing
    Set fsObj = Nothing
    ...
    <some processing which may raise an error>
    ...
    Kill ("C:\Temp\MyFile.txt")    ' Works if no error raised & processing continues ok
    ...
    ...
Loop

ErrorHandler:
    Kill ("C:\Temp\MyFile.txt")                             ' Permission Denied
    Set fsObj = CreateObject("Scripting.FileSystemObject")
    fsObj.DeleteFile("C:\Temp\MyFile.txt", True)            ' Permission Denied 
    Dim lRet As Long
    lRet = DeleteFile(gstrBodyTextFile)                     ' Nothing done
    ' After error, processing returns to calling procedure 
    ' which is in a loop and calls back into here and starts
    ' to fail on CreateTextFile

This has me stumped I have to admit, if anyone can suggest what it might be I would appreciate it. I should add that McAfee was installed on the machine but I’ve removed that to rule out its inteference (even though Unlocker should nothing else as interfering with the file) but still the error persists.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:36:03+00:00Added an answer on June 1, 2026 at 11:36 am

    I dont think this will solve it all but I think it’s worth trying:

    Dim fl As File
    If fso.FileExists(FileName) Then
        Set fl = fso.GetFile(FileName)
        If (fl.Attributes And ReadOnly) Then
          fl.Attributes = fl.Attributes - ReadOnly
        End If
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm investigating a serious performance problem in my OSGi-based application which is using Eclipselink
I'm currently investigating a problem with a 3rd party component (DevExpress) in my application.
We have a legacy VB6 app, which is critical to our business. We're working
I'm investigating a little problem for my employer. My company runs a website under
I am investigating a strange problem with my application, where the behaviour is different
I'm having a peculiar problem in a WPF-app I've written. It has a single
I am investigating a problem calling a web service from AJAX, which intermittently faults
While investigating an issue with application I'm working on, I've came across one behavior
I am investigating the use of web frameworks with my Java web-app. My basic
I'm investigating a performance problem with Jetty 6.1.26. Jetty appears to use Transfer-Encoding: chunked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.