View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default how use SheetActivate in vba code

im try
https://docs.microsoft.com/en-us/off....sheetactivate

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Call unload
Call load
End Sub


but vba call code does not run automatically when entering the sheet


activate

Sub load()
If Application.COMAddIns ("iakun"). Connect = True Then
Application.COMAddIns ("iakun"). Connect = False
Application.COMAddIns ("iakun"). Connect = True
Else
Application.COMAddIns ("iakun"). Connect = True
End If
End Sub

deactivate

Sub unload ()
If Application.COMAddIns ("iakun"). Connect = False Then
Application.COMAddIns ("iakun"). Connect = True
Application.COMAddIns ("iakun"). Connect = False
Else
Application.COMAddIns ("iakun"). Connect = False
End If
End Sub


something is wrong, with the vba code that I made ?


I suggest you check to see that Application.EnableEvents is turned on:

In the Immediate Window type ?Application.EnableEvents and hit Enter
return s/b True

If not then type Application.EnableEvents=True and hit Enter

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion