cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable Autosave in Excel via VB.net code

Arthur93
Level 5

Hello BP community!

We recently have run into an issue with the Autosave-feature in Excel. When dealing with Excel documents located on a SharePoint website, we have noticed that the Autosave-feature is turned on by default. I can understand that is great for the human co-worker, however for the robot this is not ideal as you may not want to save your changes all the time. It would therefore be great if the robot is able to disable the Autosave-feature in Excel when desired (ideally via a code stage which can be added to the Excel vbo). Does anyone already have had success with dealing with the Autosave-feature in Excel and how did you guys get around this?

Thanks in advance!



------------------------------
Arthur Philippa
RPA Developer
Port of Rotterdam
Europe/Amsterdam
------------------------------
4 REPLIES 4

AndreyKudinov
Level 10
https://support.microsoft.com/en-us/office/what-it-administrators-should-know-about-autosave-88e0f80f-e5ea-441b-9c5a-259f08490ae7?ui=en-us&rs=en-us&ad=us

------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------

PritamPoojari
Level 6
Hi
Instead of updating the file in SharePoint directly, can the robot download copy of the excel file on the machine, manipulate it and then upload it to SharePoint?

------------------------------
Pritam Poojari
Solution Architect
Capgemini
Europe/London
------------------------------

Hi,

The programmatic way to disable AutoSave for a specific workbook would be to set the AutoSaveOn Flag to False

ActiveWorkbook.AutoSaveOn = False


------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

Hi Shashank,

Many thanks for your input!

Just tested the code and I was able to get it working!
I now have created a code which can toggle the AutoSave On or Off depending on a flag provided in the code input and added it to the Excel vbo.

For who is interested, the code is as following:

Dim wb as Object
Dim excel as Object

Try
wb = GetWorkbook(handle, workbookname)
excel = wb.Application

wb.AutoSaveON= Turn_AutoSave_ON

Success = True

Catch e As Exception
Success = False
Message = e.Message

Finally
wb = Nothing
excel = Nothing
End Try

Cheers!

------------------------------
Arthur Philippa
RPA Developer
Port of Rotterdam
Europe/Amsterdam
------------------------------