File already open error
Results 1 to 4 of 4

Thread: File already open error
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Nov 2018
    Posts
    200
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default File already open error

    I want to move a file to another folder. Using this code, i got error "File already open"
    Code:
     Name "c:\sour\file.txt" As "c:\dest\file.txt
    Is there a workaround to move the file even when it is opened ?

  2. #2
    Board Regular NdNoviceHlp's Avatar
    Join Date
    Nov 2002
    Location
    Manitoba Canada
    Posts
    2,268
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)

    Default Re: File already open error

    U can trial this code here.... https://www.mrexcel.com/forum/excel-...light=copyfile
    HTH. Dave

  3. #3
    Board Regular
    Join Date
    Nov 2018
    Posts
    200
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: File already open error

    Quote Originally Posted by NdNoviceHlp View Post
    U can trial this code here.... https://www.mrexcel.com/forum/excel-...light=copyfile
    HTH. Dave
    that will only copy file, how will it move a file?

  4. #4
    Board Regular NdNoviceHlp's Avatar
    Join Date
    Nov 2002
    Location
    Manitoba Canada
    Posts
    2,268
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    2 Thread(s)

    Default Re: File already open error

    Sorry but U can't move an open file. U can use Copyfile to copy an open file to a new location. U can then close and Kill the old file. Why not just close the file before moving it? If the file may be either open or closed ( ie. unknown) then just add some error code to address both outcomes. HTH. Dave

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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