Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.
Sub RemoveVBAFiles() Dim pVBAProject As VBProject Dim vbComp As VBComponent Dim i As Integer Dim n As Integer ' Get the VBA project ' Set pVBAProject = ThisWorkbook.VBProject Set pVBAProject = Application.Workbooks("Oz_main.xls").VBProject n = pVBAProject.VBComponents.Count For i = n To 1 Step -1 Set vbComp = pVBAProject.VBComponents.Item(i) Select Case vbComp.Type Case vbext_ct_StdModule If vbComp.Name <> "Module1" Then pVBAProject.VBComponents.Remove pVBAProject.VBComponents.Item(i) End If Case Else If vbComp.Name <> "ThisWorkbook" And vbComp.Name <> "Sheet1" Then pVBAProject.VBComponents.Remove pVBAProject.VBComponents.Item(i) End If End Select Next MsgBox "Sheet has been cleared of all modules" End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.