+ Reply to Thread
Results 1 to 9 of 9

View path on Workbook_Open fails on Sharepoint

  1. #1
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    View path on Workbook_Open fails on Sharepoint

    Why does this code fail on Sharepoint?

    Please Login or Register  to view this content.
    It works on my desktop.

    Is there a workaround?



    What I really want to do is check if the workbook has been moved and if so, run some code.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: View path on Workbook_Open fails on Sharepoint

    I don't have a possibility to try this, no sharepoint, wouldn't know why it should give an error.
    And... why do you want this in a Workbook_Open event?
    What is the exact error message?
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: View path on Workbook_Open fails on Sharepoint

    I want to detect if the Excel file has been moved (or copied) to a new location. If so it would have to update some links.
    I could of course do this with a button it will be kind of awkward. How to explain to the user that things have been updated? Maybe a button that disapears after one click...

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: View path on Workbook_Open fails on Sharepoint

    You explanation is quite unclear.
    How will you know if it has moved to a new location by displaying a message box?

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: View path on Workbook_Open fails on Sharepoint

    The messagebox was just for testing and verifying that it is possible to retrieve the path. If this simple test works, then I have what I want for my code project. If it does not work there is no point trying to implement it.

    In the real code I will store the path as a worksheet constant and then compare it with the current path every time the workbook is opened. If it is not the same, the workbook has been moved or copied and this will trigger various pieces of code to run, updating links etc.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: View path on Workbook_Open fails on Sharepoint

    It should work under all circumstances but like I said, I do not have a Sharepoint environment to follow the stpes you want.
    Yes store the initial path value in a (hidden worksheet) and then check it on opening.
    Is this something like wanting to make sure that only one person uses the file or one PC only?

  7. #7
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: View path on Workbook_Open fails on Sharepoint

    It is to update some hyperlinks.

  8. #8
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: View path on Workbook_Open fails on Sharepoint

    It worked fine for me.
    Ie running workbook open with that line in it from share point, and getting the popup.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  9. #9
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: View path on Workbook_Open fails on Sharepoint

    I put this formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in a worksheet name (WBPath).

    Then I use WPPath in my Hyperlink formulas. Works fine. Recently it seems common to answer my questions on the forum with a "Why do you want to do that?" question (not just this thread).
    I might as well answer that right away. It's for linking pdf's locally. We are now working with some Sharepoint online (or whatever). Just creating links in the workbook to a pdf via VBA works but the links are converted to SP online links when you save. Althought these SP links seems to work fine, they are slower and the pdf's open up in the browser instead of the pdf reader. Because of this (and previous struggles) I prefer to use VBA to put the links in HYPERLINK formula instead.
    Most people working with this will work on synced folders on their HD's. It seems to work fine.


    https://exceljet.net/formula/get-workbook-path-only

+ 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. SharePoint Path Not Found when Running Looping Macro
    By wakerider05 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-28-2015, 05:26 PM
  2. Run-time error '76' - Path not found - (Workbook_Open) - UserForm
    By Francisco Sousa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-23-2013, 07:15 PM
  3. VBA to add item to SharePoint DataSheet view?
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2013, 01:35 PM
  4. Copying from Sharepoint to Hard Drive Fails
    By JayRenn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-03-2012, 02:14 PM
  5. Workbooks.Open() fails in ThisWorkbook.Workbook_Open()
    By GordonRehling in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-03-2011, 08:17 AM
  6. Verifying path fails for no apparent reason..Clueless
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2006, 03:55 PM
  7. [SOLVED] Workbooks.Open fails when using a full network path....
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2006, 12:15 PM

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