Consulting

Results 1 to 5 of 5

Thread: Saving to OneDrive using VBA powerpoint

  1. #1

    Saving to OneDrive using VBA powerpoint

    Apologies for lack of forum etiquette (first post)

    I am trying to make a button in powerpoint that will save a copy of the powerpoint to onedrive.
    why not just use the menus you may ask? well the macro also removes the VBA code.

    The problem is the code I am using is incredibly slow. Typically, a 75mb powerpoint will appear in the onedrive folder immediately if you save conventionally
    but will take over a minute using a macro button. Using VBA, a dialogue box appears with the "uploading to sharepoint" dialogue box which prevents the user from
    doing anything for the duration.

    code below
    ActivePresentation.SaveAs FileName:= _
    "https://companyname-my.sharepoint.com/personal/john_doe_companyname_com/Documents/testpowerpointfile.ppsx"

    The above code is what the macro recorder in Word and Excel suggest. Unfortunately, microsoft removed the recorder for powerpoint so I have no idea how it is supposed to be done
    to reduce the upload time. any help appreciated

  2. #2
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    5,994
    Location
    Q: SharePoint or OneDrive?
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,700
    Location
    As Paul says SharePoint or One Drive?

    Assuming you do mean OneDrive

    Call ActivePresentation.SaveAs(FileName:="https://d.docs.live.net/Your CID/testing2.pptx")
    OR
    Call ActivePresentation.SaveAs(FileName:="https://d.docs.live.net/Your CID//Documents/testing2.pptx")

    Your CID will be an 8 digit Hex number (ie 16 characters e.g. EAF7126A7B9FA22E) to get this go to onedrive.live.com and log in. It will show in the address bar.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    When I open Onedrive from portal.office.com, the url is as https://companyname-my.sharepoint.com.
    As I mentioned previously, using the macro recorder from excel or word to save to 'onedrive' conventionally yields the following:


    ChDir "C:\Users\john.doe\OneDrive - COMPANY NAME LIMITED"
    ActiveWorkbook.SaveAs Filename:= _
    "https://companyname-my.sharepoint.com/personal/john_doe_companyname_com/Documents/Book1.xlsx" _
    , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

    From this I believe it is sharepoint but it is called one drive sometimes

  5. #5
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,700
    Location
    OneDrive for business uses SharePoint (as opposed to One Drive Personal

    That said your original code looks correct and the equivalent here runs quickly (It is a small file though but we have a very slow connection)
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •