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:= _

    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
    Apr 2007
    Q: SharePoint or OneDrive?

    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

  3. #3
    VBAX Master
    Feb 2007
    As Paul says SharePoint or One Drive?

    Assuming you do mean OneDrive

    Call ActivePresentation.SaveAs(FileName:=" CID/testing2.pptx")
    Call ActivePresentation.SaveAs(FileName:=" CID//Documents/testing2.pptx")

    Your CID will be an 8 digit Hex number (ie 16 characters e.g. EAF7126A7B9FA22E) to get this go to and log in. It will show in the address bar.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials

  4. #4
    When I open Onedrive from, the url is as
    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:= _
    "" _
    , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

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

  5. #5
    VBAX Master
    Feb 2007
    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

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