Hello everyone.
It is possible to update a queries in to a protected sheet automatically or it is just a myth?
Sub RefreshmyQuery()
Sheets("mySheet").Unprotect Password:="myPassword"
ActiveWorkbook.Connections("Query - myQuery").Refresh
Sheets("mySheet").Protect Password:="myPassword"
End Sub
I have tried this way but I still got the error that the sheet is protected. And what I wanna to be automatically refreshed after 2 hours, or when I open the file? Any idea will be helpful!
Thank you.
It is possible to update a queries in to a protected sheet automatically or it is just a myth?
Sub RefreshmyQuery()
Sheets("mySheet").Unprotect Password:="myPassword"
ActiveWorkbook.Connections("Query - myQuery").Refresh
Sheets("mySheet").Protect Password:="myPassword"
End Sub
I have tried this way but I still got the error that the sheet is protected. And what I wanna to be automatically refreshed after 2 hours, or when I open the file? Any idea will be helpful!
Thank you.