Results 1 to 10 of 10

Thread: [RESOLVED] Excel: Can a file be "in use" without being "Open"

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2010
    Location
    Bristol
    Posts
    36

    Resolved [RESOLVED] Excel: Can a file be "in use" without being "Open"

    I am getting Error 75 Path/File access error, (file in use already I think), when I try to rename it (with coding). I am fairly sure that the file (Workbook) is closed. I read that the error would be number 55 if the file were open. The only person using the computer is me through the VBA program that has caused me so much trouble to date. When my program closes the file it disappears from the Status line as one would expect. I was under the impression that if a W/Book was being used by the master W/Book that it would appear as a "Grouped" file, but it does not appear on the Status line. Do I need to de-activate the file as well as close it? This is somewhat intermittent as the rename is sometimes successful but I haven't quite sorted out when and why. Any suggestions would be gratefully received.
    Last edited by maurice_whittaker; Feb 23rd, 2012 at 11:58 AM.

  2. #2
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Excel: Can a file be "in use" without being "Open"

    MW

    I see that you closed the prior thread and that
    this one seems to be what you referenced therein.

    I'm not sure I know enough about this "new" issue
    to be of much help, but perhaps you could start
    by posting a small code snippet that includes the
    line that produces the error.

    Spoo

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Excel: Can a file be "in use" without being "Open"

    Do I need to de-activate the file as well as close it?
    it may be that you still have some reference to an object of the workbook which is holding it as open

    as your code is not posted here it is hard to make suggestions
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2010
    Location
    Bristol
    Posts
    36

    Re: Excel: Can a file be "in use" without being "Open"

    Sorry, I will type that all again - this system keeps kicking me off but not until I submit my reply. Thanks Pete and Spoo. It will be short this time to avoid being ejected. I will try Pete's suggestion and if I remember correctly, all I have to do is to set the object to "nothing". Can either of you suggest a way to show a form which self-destructs after a short time? I beleive the form has to have a timer on it but my toolbox does not show one. Sorry about the rush. Thanks

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Excel: Can a file be "in use" without being "Open"

    no timer in vba, try application.ontme
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2010
    Location
    Bristol
    Posts
    36

    Re: Excel: Can a file be "in use" without being "Open"

    Thanks Pete, I think I have news! I searched through for any objects not reset and the only one I found was in the sub for getting the "Extent" of a sheet which you were involved in refining if I remember correctly. I reset that to nothing but it was totally unrelated to my problem I think. One thing I did find was that when I had copied sheets from the W/Book causing the problem, I closed it without saving it because (in my innocence) I thought that copying from a book did not change it therefore it did not need it. Since I put a save in it seems to have solved the problem BUT I need to be convinced that this was the problem. I truly hope so! Whilst going through this, I removed "End" from my program as I understand it is not a good thing to have BUT I got terrible problems with "Run Over" into other subs and I had to re-instate it. If you will bear with me for a while I will leave this unmarked as resolved until I am sure. Thank you, once again, for your help and I will try "ontme" Tomorrow.

  7. #7

    Thread Starter
    Member
    Join Date
    Oct 2010
    Location
    Bristol
    Posts
    36

    Re: Excel: Can a file be "in use" without being "Open"

    Hi Folks, I have now re-run the prog. with the "Save" removed and I have succeeded in reproducing the problem! Needless to say, I put it back in very smartly! I will now mark the thread resolved and thanks again. My version is "Microsoft Exceel Version 12.0 running on Windows (32 bit) NT 5.01". I thought I had XP! This version does not have "ontme". Have you any tips on how to do away with "End". To be honest it does not cause any problems that I can see but it is apparently bad practice.
    Maurice

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [RESOLVED] Excel: Can a file be "in use" without being "Open"

    Have you any tips on how to do away with "End"
    depends where you are using it
    exit sub if you are running a single procedure, or the code will finish at the end of that procedure
    unload me if you are working with a user form

    This version does not have "ontme
    i have never looked a this version, but i find that a bit surprising, you may have to build your own timer, but it may appear to hang excel while it is working

    I have now re-run the prog. with the "Save" removed and I have succeeded in reproducing the problem! Needless to say, I put it back in very smartly!
    you can probably close without saving, providing you specifically tell it to do so
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9

    Thread Starter
    Member
    Join Date
    Oct 2010
    Location
    Bristol
    Posts
    36

    Re: [RESOLVED] Excel: Can a file be "in use" without being "Open"

    Thanks Pete, I am feeling much more relaxed now and I have made quite good progress since the awful period I've just been through!
    TTFN, Maurice.
    Last edited by maurice_whittaker; Feb 26th, 2012 at 06:25 PM. Reason: Bad spelling

  10. #10
    Hyperactive Member
    Join Date
    Oct 2010
    Location
    Indiana
    Posts
    457

    Re: [RESOLVED] Excel: Can a file be "in use" without being "Open"

    Just some extra info, but in windows 7, if you have the "Preview Pane" option turned on, and try to open a file, such as a spreadsheet, it opens the file to provide a preview. I have found this to be quite problematic, for some files it shows that the files are open and gives the users errors and it opens the file as read only. It doesn't seem to do it all the time, but it is a royal pain...

    I have just advised everyone to leave it off.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width