+ Reply to Thread
Results 1 to 6 of 6

Open folder (call shell) not known full filename

  1. #1
    Registered User
    Join Date
    03-07-2016
    Location
    Spain
    MS-Off Ver
    2013
    Posts
    16

    Open folder (call shell) not known full filename

    Hello!

    My macro creates folders named year.number.description (2016.185.Hello).

    The problem is that this name may be changed, so for example, after some days someone renames it to 2016.185.Hi

    In the same macro there is an option to open that folder.

    I thought that adding ".*" would work but it seems not.

    Please Login or Register  to view this content.
    Thanks for your attention!

  2. #2
    Forum Contributor
    Join Date
    01-09-2016
    Location
    Perth Western Australia
    MS-Off Ver
    Office 365
    Posts
    257

    Re: Open folder (call shell) not known full filename

    Hi

    Is it possible to prevent others renaming the folder as I think that may be the better solution.

    Cheers

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Open folder (call shell) not known full filename

    Quote Originally Posted by Ignasis View Post
    Hello!

    My macro creates folders named year.number.description (2016.185.Hello).

    The problem is that this name may be changed, so for example, after some days someone renames it to 2016.185.Hi

    In the same macro there is an option to open that folder.

    I thought that adding ".*" would work but it seems not.
    Try this...
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    03-07-2016
    Location
    Spain
    MS-Off Ver
    2013
    Posts
    16

    Re: Open folder (call shell) not known full filename

    AlphaFrog, your code works perfect!!

    Thank you very much!

    And..would you mind explaining what does this code? I searched getattr function and seems you want to find the current directory for the folder or something like this?

    Please Login or Register  to view this content.
    thanks for your time!

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Open folder (call shell) not known full filename

    You're welcome.

    The DIR function with a wildcard will return the first match it finds in the given root folder. That match can be a subfolder or a file. That code block you asked about tests if the match was of type folder, and if not then loop until it does find a match that is of type folder.

  6. #6
    Registered User
    Join Date
    03-07-2016
    Location
    Spain
    MS-Off Ver
    2013
    Posts
    16

    Re: Open folder (call shell) not known full filename

    Great, I see the logic!

    thanks again sir!

    edit: marked as solution, sorry for the delay.
    Last edited by Ignasis; 05-02-2016 at 03:32 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. call shell from VBA
    By cmccabe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2014, 03:52 PM
  2. Call Shell - return code?
    By swoop99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2013, 09:18 AM
  3. open all files in a folder with fixed number of characters in filename
    By Telemick in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-18-2012, 03:31 AM
  4. How to close open workbooks from an application get open filename call ?
    By leanne2011 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2011, 10:41 PM
  5. CALL SHELL doesn't recognise the directory
    By plancast in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2009, 12:00 PM
  6. [SOLVED] how shell open AcroReader w/command line filename?
    By Ian Elliott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2005, 03:05 PM
  7. Shell Invalid Procedure call or argument
    By rgans in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2005, 12:23 PM

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