ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how use SheetActivate in vba code (https://www.excelbanter.com/excel-programming/454611-how-use-sheetactivate-vba-code.html)

[email protected]

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 ?

GS[_6_]

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


All times are GMT +1. The time now is 03:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com