+ Reply to Thread
Results 1 to 6 of 6

Open a folder for viewing from a UserForm

  1. #1
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Open a folder for viewing from a UserForm

    Once one of you guys was kind enough providing me the code below.
    This is a CommandButton on a Form that opens an image in a separate window.

    Please Login or Register  to view this content.
    Now, what I'd like to have is another CommandButton that instead of opening the image, it opens a Windows Explorer window with the Folder on it's screen the relevant picture is residing in.

    So basically the code would take the Address of the image that is stored in Cells(MyLine, MyPic) , would chop off the filename, leave the address of the folder only and would open the Explorer with that folder shown.

    Not sure if it is clear enough.

    Thx
    Gabor

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Gabor,

    Place this macro in a Standard VBA Module in your project. When you call the macro, the full folder path follows the macro.
    Calling Example
    Please Login or Register  to view this content.
    Macro Code
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226
    Leith,

    Thanks I have made it work.
    Almost.
    The cell contains a string that is the path and the filename so using your code first I have to modify that string in such a way that the filename is omitted.
    Example:
    The content of the cell is:
    C:\Documents and Settings\gz41rs\My Documents\My Pictures\09-Fam1Motors\PC170123.JPG
    So to make the code work I need to eliminate from the End of the string this: PC170123.JPG
    so it will look like this:
    C:\Documents and Settings\gz41rs\My Documents\My Pictures\09-Fam1Motors\

    And the code will work then.

    Of course the filenames are with different lengths.

    Any ideas?

    Thanks, Gabor

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Gabor,

    I updated ShowFiles so you can use the full path. The variable Fp is file directory path.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  5. #5
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Now OK

    Works fantastic.

    Thanks

    Gabor

  6. #6
    Forum Contributor
    Join Date
    09-02-2005
    Posts
    146
    Quote Originally Posted by Leith Ross
    Hello Gabor,

    Place this macro in a Standard VBA Module in your project. When you call the macro, the full folder path follows the macro.
    Calling Example
    Please Login or Register  to view this content.
    Macro Code
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    I'm trying to use this to work with a SharePoint website, but nothing is happening. The code just seems to skip this line. No error messages or anything. I'm using it like this:

    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