Forum Discussion
serpiva64
Jan 26, 2023Copper Contributor
Copying a query from a protected file
Hi,
why is possible to copy a query if the file is protected with Protect structure
as you can see if you try, the copy is an option always enabled
and it is possible to copy and paste the query in another file
Thank you very much if someone has a solution to avoid copying
3 Replies
- NikolinoDEPlatinum Contributor
I'm not sure if it works with PQ without problems, you could try it with VBA.
I also don't know your digital environment (Excel version, operating system, storage medium, etc.),so I'm not sure whether VBA could be a solution at all in your digital environment.
Whatever the case, the proof of the pudding is in the studying :).
Attached is the VBA code and an example file.
Option Explicit Private Sub Workbook_Activate() Application.CutCopyMode = False End Sub Private Sub Workbook_SheetActivate(ByVal Sh As Object) Application.CutCopyMode = False End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Application.CutCopyMode = False End Sub
Hope I could help you with these information.
I know I don't know anything (Socrates)