+ Reply to Thread
Results 1 to 3 of 3

Thisworkbook.path Works if on USB drive, but not if on Desktop

  1. #1
    Forum Contributor
    Join Date
    11-25-2012
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    146

    Thisworkbook.path Works if on USB drive, but not if on Desktop

    I run this and it works perfectly when I run it off my USB drive. It puts the CSV files in the same spot I am running the workbook from.
    When I take the workbook and put in directly on the desktop, then run it again, I get nothing. It seems to run, but no CSV files on the desktop and no errors.
    stumped...also tried Activeworkbook.path instead of thisworkbook and same thing

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Thisworkbook.path Works if on USB drive, but not if on Desktop

    You'll probably find it one directory up the tree. Instead of being in 'c:\users\name\desktop' it'll be in 'c:\users\name' and the file name will start with 'desktop...'

    The Path property (of any object - workbook, application) returns a path, but it's not terminated with a trailing '\'. If the file is located in the root directory of a drive (any drive - not particular to your USB drive), it returns 'Z:' which then gets (assuming that cell C3 contains 'test') 'test SlideMain.csv' appended and 'Z:test SlideMain.csv' is a valid file path.

    If you try to save it in the Desktop directory, the constructed file name will be 'C:\Users\Name\Desktoptest SlideMain.csv', which is not exactly where you want it to go, but a valid path, nonetheless...

    Simple debugging, testing the constructed file name, would have saved you some time...
    Last edited by cytop; 07-23-2017 at 02:09 AM.

  3. #3
    Forum Contributor
    Join Date
    11-25-2012
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    146

    Re: Thisworkbook.path Works if on USB drive, but not if on Desktop

    Thanks for your help!

+ 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. Links Error: Remote Path vs T:Drive Path
    By bbarrene in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-11-2010, 11:18 AM
  2. Have script, works with P:\ (drive letter), not with \\server\folder\ (direct path)
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-14-2008, 06:03 PM
  3. Can you store a macro on the Desktop, G-drive or C-Drive
    By XxXElAiNeXxX in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2007, 01:40 AM
  4. Use an icon from a network drive for a desktop shortcut
    By jhize in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-01-2007, 09:22 AM
  5. Replies: 1
    Last Post: 01-17-2006, 04:35 PM
  6. [SOLVED] ThisWorkbook.Path not working...
    By rmullen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2006, 04:20 PM
  7. Desktop file sharing:network drive
    By Anne Troy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  8. [SOLVED] Macro won't run from d: drive, but works on c: drive
    By GFN in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-03-2005, 03: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