Created
October 7, 2015 19:27
-
-
Save hexerei/8b3f532ae73124571ffa to your computer and use it in GitHub Desktop.
Selfdestructing VBA Code - Code to remove all VBA Modules from given Window - i.e. after copying Table, remove code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim x As Integer | |
With ActiveWindow | |
.Visible = False | |
.Activate | |
On Error Resume Next | |
For x = .VBProject.VBComponents.Count To 1 Step -1 | |
.VBProject.VBComponents.Remove .VBComponents(x) | |
Next x | |
For x = .VBProject.VBComponents.Count To 1 Step -1 | |
.VBProject.VBComponents(x).CodeModule.DeleteLines _ | |
1, .VBProject.VBComponents(x).CodeModule.CountOfLines | |
Next x | |
End With |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment