+ Reply to Thread
Results 1 to 11 of 11

Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    uk
    MS-Off Ver
    Excel 2013
    Posts
    12

    Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Hi everyone, some words of wisdom please....

    I have a workbook with several sheets and macros. Some of these macros attempt to save/open files to/from a subfolder inside a local ONEDRIVE folder.
    I need to be able to set this up on multiple machines (all with different OneDrive accounts)and for them all to work.....

    When I test the following on a 'dummy' onedrive folder (that is not actually connected to OneDrive) this path/address it works.

    Trying it on a 'real live' onedrive folder gives me an error.

    Please Login or Register  to view this content.
    I have also tried this with no sucess

    Please Login or Register  to view this content.
    and this is broken too .... ;(

    Please Login or Register  to view this content.
    Please can anyone help?

    Many thanks in advance :

    Gideon
    Last edited by osbertdebroilg; 05-29-2015 at 06:31 PM. Reason: Added Code Tags

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,344

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    If your system is anything like mine, the folder is actually SkyDrive, not OneDrive.

    C:\Users\...username...\SkyDrive


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,344

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Yep, that's it on my system ... change OneDrive to SkyDrive

    Regards, TMS

  4. #4
    Registered User
    Join Date
    05-29-2012
    Location
    uk
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Hi,

    Thanks for this. I have checked and my folder is def called OneDrive on both my systems (set up after the MS name change to OneDrive), so I don't think that your suggestion would work??????

    Thanks,

    Gideon

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,344

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    It appears as OneDrive in Windows Explorer but, if you select the folder and then click in the folder selection box, you will probably see it says SkyDrive.

    But, one easy way to check ... change it in your code and test it. Your choice

  6. #6
    Registered User
    Join Date
    05-29-2012
    Location
    uk
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Now you are making sense! Thanks for the more detailed explanation of your reasoning - I didn't understand, and I shall certainly give it a try!

    Many thanks

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,344

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    See the image ...

    SkyDrive.jpg

  8. #8
    Registered User
    Join Date
    05-29-2012
    Location
    uk
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Hi TMS,

    I'm afraid that this didn't work..... any other ideas please?

    Thanks,

    Gideon

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,344

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Sorry, that was the best shot. Changing your code worked for me in terms of saving a file directly into the OneDrive/SkyDrive folder.

    The only difference was that I wasn't trying to build a file name from the contents of cells. Itt could be that the combination of cell contents doesn't make an acceptable folder/file name.

    I note that this:
    Please Login or Register  to view this content.
    appears to be wrong.

    I'd expect
    Please Login or Register  to view this content.
    You also refer to !Registers in one example and !Reports in another. Are both those folders present?

    Regards, TMS

  10. #10
    Registered User
    Join Date
    05-29-2012
    Location
    uk
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Ok, I have an answer - for anyone who is interested!

    I couldn't work out what the correct syntax was to directly reference one drive from a macro with a full path. I did discover that you can if you are working with an open file that is saved in onedrive, you can ask for things to be save relative to it's location - i.e. using ..\

    I then found out that working with open files in onedrive,files, which by the nature of their design need closing and opening again in rapid succession causes all sorts of conflicts with updating and you end up with duplicates which are renamed and therefore not the files that your excel sheet is calling for

    My solution was to run everything from a local folder which I linked with the Onedrive folder with mklink - but even this wasn't simple as Onedrive doesn't like pulling files 'in' from outside - but it does let you 'push them out......

    so, you have to create your local folder, cut copy and paste into OneDrive and then create a symbolic link to your original 'non Onedrive' location from there....

    mklink /d “C:\Original\Folder\Location” “C:\Users\NAME\SkyDrive\FOLDERNAME\”

    Details are here for anyone who is interested - with any luck it might save you a day of head scratching too...

    http://www.howtogeek.com/174765/how-...n-windows-8.1/

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,344

    Re: Correct save path and syntax to save workbookdirectly into ONEDRIVE subfolder

    Thanks for sharing.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Save the open sheet in a path with a save as dialogue box and also create two folders
    By Biplab1985 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2015, 05:19 PM
  2. VBA to open, edit and save to onedrive
    By MedOpsManZA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2015, 01:27 PM
  3. [SOLVED] Make another copy and save in diffrent path when i apply save
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-16-2014, 09:00 AM
  4. how to specify a file save path to a save macro
    By Solidstan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2013, 05:33 PM
  5. Macro - Save Workbook to subfolder
    By PRodgers4284 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2009, 07:01 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