+ Reply to Thread
Results 1 to 5 of 5

Opening a folder location issue

  1. #1
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Opening a folder location issue

    Hello.
    I am trying to open a folder with shell.
    When I use the following code in the immediate window it works properly.
    Please Login or Register  to view this content.
    however when I put in this code in the module I get a syntax error.
    I tried to remove the "(" & ")" from the equation however it stops working.

    Please advise what I'm doing wrong.

    Thank you for your help in advance

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Opening a folder location issue

    In regular VBA code, no symbol is needed preceeding the Shell command. Here is a link to the MS spec sheert.
    https://support.office.com/en-us/art...6-6832EADD3C63
    It looks like you might have the path and file reversed.
    Last edited by JLGWhiz; 04-26-2018 at 04:43 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Opening a folder location issue

    Thank you for your reply
    that's exactly my problem.
    When I input the following :
    Please Login or Register  to view this content.
    inside a macro it stops working.

    Anybody have ideas for solutions?
    what am I writing wrong?

    Eli

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Opening a folder location issue

    The ? is used in the immediate window to display variable content or return values from a function call.

    The help on shell says.
    Runs an executable program and returns a Variant ( Double ) representing the program's task ID if successful, otherwise it returns zero
    So when I try it I get the value 4752 displayed in the immediate window.

    In order to run the command in a routine you can either display the value or not. Use MsgBox instead of ?

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Opening a folder location issue

    Hi Andy
    Thank you for your help.
    My problem was that I did not use the quote mark before the explorer.

+ 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. Linking Two Workbooks in the Same Folder and Excluding the Folder Location
    By 96Mustang460cid in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-29-2017, 02:27 AM
  2. [SOLVED] Making a folder and Opening the folder
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2016, 08:20 AM
  3. [SOLVED] Looking for Macro to pull folder name and folder size of a specific location.
    By TheDirtyDrunk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2016, 09:19 AM
  4. [SOLVED] Specific folder when opening windows popup folder selection with msoFileDialogFolderPicker
    By trizzo in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-18-2015, 11:05 AM
  5. Open Folder (Prompt User for final folder name in location path)
    By synergeticink in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2014, 03:33 PM
  6. create new folder at one location and copy photos in that folder from other location
    By meer_ali in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2014, 05:20 AM
  7. "Folder Select" Dialogue - Opening multiple files from selected folder
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2005, 10:05 AM

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