+ Reply to Thread
Results 1 to 9 of 9

check if a folder is open

  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    6

    check if a folder is open

    Hello,

    I would like a code example that checks whether a specific folder is already open or not.

    Regards,

    Spyros

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: check if a folder is open

    Maybe:

    Function:

    Please Login or Register  to view this content.
    Sample use;

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-29-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: check if a folder is open

    Hello John,

    Thanks for you reply but i am asking to check for a folder and not for a file.

    Regards,

    Spyros

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: check if a folder is open

    Sorry for the misunderstanding. Hope someone can help you.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: check if a folder is open

    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Registered User
    Join Date
    05-29-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: check if a folder is open

    Thanks for the suggestion, the thing is that i am not so advanced and i cannot overcome an error i get error.png



    That is the code i am trying to use. where ""U:\myfolder\mysubfolder\"" is an example of the folder that i interested in(mysubfolder) path.

    Please Login or Register  to view this content.
    any help will be appreciated.

    Regards,

    spyros

  7. #7
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: check if a folder is open

    I would guess it is the followhyperlink that is the problem, you probably need:
    Please Login or Register  to view this content.
    However, what your code will do is check every window you have open and if that is not the folder you are looking for it will open the folder again. You probably need something like:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-29-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: check if a folder is open

    Well your new line individually works, but now i am getting another error2.png when i am trying to run the routine.



    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: check if a folder is open

    Err, I think that wnd.document.folder will only work for things that have a folder (e.g. windows explorer) and not for applications. The proper way to fix this would be the determine the type of each item in oshell.windows and only run the if statement for ones that have the folder property.

    Afraid I don't know how to do that but you can get round it with something like:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1