Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-24-2019, 09:03 PM
kiwimtnbkr kiwimtnbkr is offline Worksheet_Activate only if .xltm Windows 10 Worksheet_Activate only if .xltm Office 2010 64bit
Advanced Beginner
Worksheet_Activate only if .xltm
 
Join Date: Oct 2017
Posts: 69
kiwimtnbkr is on a distinguished road
Default

Resolved by deleting the macro when saving the file as a .xlsm file. The following code was placed inside a Module.

Code:
Sub DeleteWorksheet_Activate()
Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents
Dim VBProj As VBIDE.VBProject
Dim CodeMod As VBIDE.CodeModule
Dim StartLine As Long
Dim NumLines As Long
Dim ProcName As String

Set VBComps = This Workbook.VBProject.VBComponents
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBcomponent("Sheet4")
Set CodeMod = VBComp.CodeModule

For Each VBComp In VBComps
     Select Case VBComp.Type
          Case vbext_ct_MSForm
               VBComps.Remove VBComp
     End Select
Next VBComp

ProcName = "Worksheet_Activate"
     With CodeMod
          Startline = .ProcStartLine(ProcName, vbext_pk_Proc)
          Numline = .ProcCountLine(ProcName, vbext_pk_Proc)
          .DeleteLines StartLine:=StartLine, Count:=NumLines
     End With
End Sub
Reply With Quote
 



Other Forums: Access Forums

All times are GMT -7. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft