+ Reply to Thread
Results 1 to 9 of 9

ActiveWorkbook.Path issues with UNC

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    ActiveWorkbook.Path issues with UNC

    I've been learning more and more about Macros and VBA to automate a small report I need to perform on a daily basis.

    I still can't write code from memory but understand a little which is why I'm dangerous. With a bit of googling and modification the code was tested and all working locally before moving to the network drive location. After moving, my code falls down at pretty much the first action of finding the name of a file to copy into the existing report.

    The reason I'm not using explicit filenames is because there is date added to the file I'm copying in.

    This line is where I get a Run-time error '52' Bad filename or number.

    Please Login or Register  to view this content.
    When it fails out hovering over activeworkbook.path show's the UNC path \\blahblah\folder\folder2 but sFound is = "".

    Please Login or Register  to view this content.
    Can I modify the existing code in any way to work with UNC paths?

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: ActiveWorkbook.Path issues with UNC

    see if this helps
    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Re: ActiveWorkbook.Path issues with UNC

    Quote Originally Posted by humdingaling View Post
    see if this helps
    Please Login or Register  to view this content.

    It fails out before we even get to the copy stage. It fails defining sFound.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: ActiveWorkbook.Path issues with UNC

    How long is the string returned by activeworkbook.path?
    Rory

  5. #5
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Re: ActiveWorkbook.Path issues with UNC

    Quote Originally Posted by rorya View Post
    How long is the string returned by activeworkbook.path?
    101 characters.

    It's a mapped drive to a SharePoint document library if that makes any difference. It also has a @ in the path which could be causing the issue?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: ActiveWorkbook.Path issues with UNC

    I don't have access to a Sharepoint folder to test but the @ shouldn't be a problem for Dir.

  7. #7
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Re: ActiveWorkbook.Path issues with UNC

    Quote Originally Posted by rorya View Post
    I don't have access to a Sharepoint folder to test but the @ shouldn't be a problem for Dir.
    Definitly a sharpoint issue. Moved to regular network drive and it works fine.

    I've since noticed that activeworkbook.path isn't returning the UNC path but the https:// path instead.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: ActiveWorkbook.Path issues with UNC

    Ah, yes - that would be a problem.

  9. #9
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Re: ActiveWorkbook.Path issues with UNC

    Quote Originally Posted by rorya View Post
    Ah, yes - that would be a problem.

    I've had to specify the UNC path to sharepoint rather than use ActiveWorkbook.path. Not the end of the world.

+ 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. [SOLVED] Data Validation linked to folders in ActiveWorkbook.Path
    By plans in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-10-2016, 11:05 AM
  2. [SOLVED] Generate Folders and Subfolders list located in the ActiveWorkbook Path
    By plans in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2015, 04:11 PM
  3. [SOLVED] Excel 2010 Activeworkbook.path
    By launas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-17-2014, 02:30 PM
  4. [SOLVED] Path Issues Importing Access Data into Excel
    By markreuter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2013, 01:46 PM
  5. ActiveWorkbook.Close issues
    By WadeLair in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2012, 05:23 PM
  6. Get partial string from ActiveWorkBook.Path
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-30-2009, 11:14 AM
  7. [SOLVED] xlDialogOpen.Show or Activeworkbook.Path?
    By Mike Echo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-29-2005, 06:07 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