+ Reply to Thread
Results 1 to 5 of 5

Shell function gives File not Found error

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Post Shell function gives File not Found error

    Operating System : Windows 7, 64-bit
    Excel Version : 2010, 32-bit
    Problem:
    When the following code executes, I get the MsgBox output and the immediate window (Debug.Print Err) shows 53 (which I believe is the "File not Found" error). However, the file is most definitely there as I have run it through the Start Menu\Run as well as through Windows Explorer. How do I run/launch the SnippingTool from within Excel? Please help.

    VBA Code (as follows)
    Please Login or Register  to view this content.
    Additional Information :
    This Macro is a part of a custom tab on the Ribbon where I would like to provide a few tools such as "Calculator", "Notepad", "Snipping Tool". These would come really handy when a user is working with this specific workbook. The same code for Calculator and Notepad works fine, but for the Snipping Tool it doesn't. However, as I would be sharing this workbook with different users, the solution needs to be such that all the necessary code/objects should be on this one single workbook.

    Warm regards,
    Jewel
    Last edited by jewelsharma; 03-04-2014 at 05:17 AM. Reason: To better explain the problem (or at least try to :))

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Shell function gives File not Found error

    This is FileSystem redirection, I think. You must use:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Thumbs up Re: Shell function gives File not Found error

    Thank you Izandol. Your suggestion is working just fine.

    Would you be so kind to elaborate on the solution (or point me to any links). I would like to understand why "C:\Windows\System32\SnippingTool.exe" was giving an error when I could browse to the file at the exact location and run it from there.

    Many thanks again & warm regards,
    Jewel

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Shell function gives File not Found error

    In 64bit Windows 7, system32 directory is reserved for 64 bit applications and 32bit executables are really stored in SysWOW64 directory. Therefore when 32 bit program accesses system32 it is automatically redirected to SysWOW64 but the SnippingTool is not in this folder and you receive error 53. (if you will try your first code in 64bit Office, it will work because there is no redirection). Use of sysnative prevents this redirection.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Shell function gives File not Found error

    Thanks again Izandol.
    What I read makes intuitive sense (despite my very limited knowledge of 32-bit or 64-bit). Importantly, I'll stick with 'sysnative' in future; and hopefully Windows will take care of necessary redirection.

    Warm regards,
    Jewel

+ 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. shell to open external bat file
    By zhuleijia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2013, 12:28 AM
  2. [SOLVED] Message (in one window) for each file found/not found
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-08-2013, 04:03 PM
  3. Problem using shell to call batch file or cmd prompt
    By nickf829 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2011, 10:27 PM
  4. Open File problem using Shell command
    By roelvdh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2010, 03:41 PM
  5. Using Shell To Get File Info
    By MDW in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2006, 07:30 AM

Tags for this Thread

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