VBA How to disable AutoSave after upload to OneDrive finishes

Anonymous
2022-11-10T14:05:11+00:00

I made a VBA to save a daily report I download into one of my Documents folders,

This folder automatically backs up to OneDrive, but I don't want AutoSave on the files, because I often open these back up to make small changes, filtering, highlighting, etc, then just close it without saving

When I use "ActiveWorkbook.SaveAs FileName:= ", it saves perfectly,

However once it finishes saving a popup comes up and says this :

(blacked out certain parts of personal name/company info)

(first black is <MyBusinessco_> and second is <MyUsername_MyBusiness_>)

I found online that you can just use ActiveWorkbook.AutoSaveOn = False, but it didn't work I believe because the popup was still open when that line of code ran.

I tried to add a line before that to wait 5 seconds, but it also made the upload wait 5 seconds, so still didn't disable autosave

My next resort is thinking of making a macro to turn AutoSaveOn to False when the workbook is closed, but that would require saving it as a .XLSM instead and adding the module to the new workbook each time, so I'm hoping there will be another solution

Even if there's another way to save the file which wouldn't enable autosave, or to disable AutoSave for an entire folder, would both be workable solutions for me

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} vote
Answer accepted by question author
  1. Anonymous
    2022-11-11T13:16:25+00:00

    Dear AndyLH2,

    Good days, thanks for querying in this forum. We’re happy to help you.

    From your description, it seems that you always edit the files with VBA code which are saved in OneDrive, and you want to disable AutoSave for them.

    If my understanding above is right, to verify your assumptions, we’d suggest you go to Excel > File > Options > Save > unselect AutoSave OneDrive and SharePoint Online files by default on Excel, as shown below:

    Then you can check if it will work.

    If the scenario above is not consistent with yours, you can also post back and point that.

    Thank you for your cooperation.

    Sincerely,

    Sukie | Microsoft Community Moderator

    0 comments No comments

0 additional answers

Sort by: Most helpful