Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove vba code after the .doc runed. #39

Closed
yanghaoi opened this issue Feb 1, 2021 · 1 comment
Closed

How to remove vba code after the .doc runed. #39

yanghaoi opened this issue Feb 1, 2021 · 1 comment

Comments

@yanghaoi
Copy link

yanghaoi commented Feb 1, 2021

HI~ , i hava one question that's , when i use code by:

Sub removeall()
Dim i, A As Integer
    For Each i In ActiveDocument.VBProject.VBComponents
        If i.Type = 1 Then
            MsgBox i.Type
            With Application.VBE.ActiveVBProject.VBComponents
                On Error GoTo ErrorHandler
                MsgBox i.Name
                .Remove .Item(i.Name)
             End With
        End If
    Next
ErrorHandler:
MsgBox "err!"
End Sub
Sub AutoOpen()
   Call removeall
   If ActiveDocument.ReadOnly = False Then
        ActiveDocument.Save
End If
End Sub
Sub Auto_Open()
AutoOpen
End Sub

What I expected was the vba code removed and .doc saved,but contrary.when i use F5 do it the vab removed .......
Can you do me a favor? Thank!

@stanhegt
Copy link
Contributor

stanhegt commented Mar 9, 2021

This issue is not related to EvilClippy.

@stanhegt stanhegt closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants