View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default ExecuteExcel4Macro to run on other page

Private Sub Worksheet_Deactivate()
Dim sht As Object
On Error GoTo errExit
Application.EnableEvents = False
Set sht = ActiveSheet
Application.ScreenUpdating = False
Me.Activate
'your code here

ActiveSheet.Range("a1") = Me.Name
sht.Activate
errExit:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

I haven't looked to see if there isn't a VBA equivalent of your XL4 macro,
if so this would not be an issue.

Regards,
Peter T

"Makelei" wrote in message
...
Hi,
XP and 2003.
I should get this to work:
Private Sub Worksheet_Deactivate()
...
For i = 1 To 14
ExecuteExcel4Macro "Sheet1.SHOW.DETAIL(1," & i & ",false)"
Next i
....
end sub

My problem is he
ExecuteExcel4Macro "Sheet1.SHOW.DETAIL(1," & i & ",false)"
That Sheet1 is not functioning when it is in Private Sub
Worksheet_Deactivate(). It tries to run it in the activated sheet. Is it
and
how is it possible to get it to run in Sheet1?

Thanks in advance
MakeLei