dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: open a path

  1. #1
    Join Date
    Mar 2018
    Posts
    11

    open a path

    I got a vba code that uses : shell(explorer.exe, path). path contains date string as mm/dd/yyyy. it does not open the path. what should done?. It does not seem to handle the date string in the path.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,319

    Re: open a path

    Not sure exactly what you are trying to do but / is not a legal character in a folder name. You can not open a folder that does not exist and you can not create a folder that has illegal character in the name.

    Now if you have a folder named 2 and in that folder is a folder named 15 and in that folder is a folder named 2019 then it would allow you to open the 2019 folder.

    If you want to create a folder based on a date then the proper way is to use a YYYYMMDD format with or without spaces between the different parts but never any slashes or colons.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Mar 2018
    Posts
    11

    Re: open a path

    got a path \\remoteSrv\myfolder1\myfolder2\01/01/2000_010230AM\myfolder3
    what is the workaround to be able to open this path in visual basic 6?. It is created by mistake by others who were not careful.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,986

    Re: open a path

    Quote Originally Posted by Y$EA View Post
    got a path \\remoteSrv\myfolder1\myfolder2\01/01/2000_010230AM\myfolder3
    what is the workaround to be able to open this path in visual basic 6?. It is created by mistake by others who were not careful.
    What OS is that file share hosted on?

  5. #5
    Join Date
    Mar 2018
    Posts
    11

    Re: open a path

    Windows 7. I like to open using VBA 6.

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,986

    Re: open a path

    Quote Originally Posted by Y$EA View Post
    Windows 7. I like to open using VBA 6.
    Front slashes generally aren't allowed in Windows. See https://docs.microsoft.com/en-us/win.../naming-a-file

    What is more important is whether VB6 (last released in 1998) recognizes the front slash as a valid character. It may not.

    Therefore, is it any possibility of changing the paths that contain front slashes to back slashes (and then have the VB6 program read them)?

  7. #7
    Join Date
    Mar 2018
    Posts
    11

    Re: open a path

    Unfortunately not. Due to some tractability reason, not.

  8. #8
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,692

    Re: open a path

    Windows is treating the / in the date string as a folder separator - the same as \. Hence it is trying to open the folder

    \\remoteSrv\myfolder1\myfolder2\01\01\2000_010230AM\myfolder3

    which of course doesn't exist. You say this name was created by mistake - how was it created?

    I suggest you search the internet for special software that allows renaming of folders/files that contain 'illegal characters' and use this to rename these folders to a Windows legal name.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.1.3)

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)