+ Reply to Thread
Results 1 to 5 of 5

Get partial string from ActiveWorkBook.Path

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Get partial string from ActiveWorkBook.Path

    I tend to stumble when trying to pull certain characters from strings, not sure how to stop and start my search.

    Please Login or Register  to view this content.
    sWbPath = ActiveWorkbook.Path
    Which is:
    F:\CNC Mill\#19 CNC CMM\Inspection Reports\SUNSTR\4503124\Results\33162-1\20
    The portion of text in Red is what I need from this path for another variable.
    sWbPathCust = sWbPath (some method of extracting the string)
    This portion of the path will always be the same:
    F:\CNC Mill\#19 CNC CMM\Inspection Reports\
    The remainder changes for many customers and part numbers.
    "SUNSTR\" = Customer and "4503124\" = Part Number
    The character length of Customer and Part Number varies for each. The only constants are the two "\" (Back slashes) after "Inspection Reports\".

    Any hints, tips and or examples are appreciated.
    Last edited by Rick_Stanich; 09-30-2009 at 11:06 AM. Reason: Corrected title
    Regards

    Rick
    Win10, Office 365

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Get partial string from ActiveWorkBook.Path

    I'm sure there's a better method...

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Re: Get partial string from ActiveWorkBook.Path

    Quote Originally Posted by DonkeyOte View Post
    I'm sure there's a better method...

    Please Login or Register  to view this content.
    I think I understand what you have done.
    The first line you change the 6th "\" to a "^"
    And the next line you change it back after getting the left length ending at "^"

    Is that correct?

    Your code works fine. Thank you!

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Get partial string from ActiveWorkBook.Path

    Yes, exactly... based on your narrative that should work ? (I think)

  5. #5
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Re: Get partial string from ActiveWorkBook.Path

    Your code did exactly as I needed.
    Again, thanks.

+ 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