Reputation: 919
I'm doing an auto-run macro, but it is password protected. After I removed all the passwords, it can save the file in a different format.
The thing is that MS Excel displays a Popup Message about "update links automatically". I Tried to disable all settings from MS Excel options but the dialog still appearing.
So, I was thinking to add some code to avoid that popup.
Here is my code:
Sub Auto_Open()
Workbooks.Open "C:\Test\WorkbookTest.xlsx"
ActiveWorkbook.UnprotectSharing ("galleta")
ActiveSheet.Unprotect ("galleta")
ChDir "C:\Users\user\Desktop\Reportes"
Sheets("BES").Select
ActiveSheet.Unprotect ("galleta")
Sheets("BE800").Select
ActiveSheet.Unprotect ("galleta")
Sheets("BECM").Select
ActiveSheet.Unprotect ("galleta")
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\user\Desktop\Reportes\test.mht", FileFormat:= _
xlWebArchive, CreateBackup:=False
End Sub
I placed my autorun with the password thing code because it may help to someone.
Other data:
The message is appearing to protect the user's platform, but may be we can configure the user preference forehand via vba.
Thank you guys.
Upvotes: 1
Views: 23967
Reputation: 27478
The second argument to Workbooks.Open is UpdateLinks. Set it to False:
Workbooks.Open "C:\Test\WorkbookTest.xlsx",False
Upvotes: 10