Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default ExecuteExcel4Macro to run on other page

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default ExecuteExcel4Macro to run on other page

Try putting the code in ThisWorkbook module not a sheet module -
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)

End Sub

Mike F
"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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default ExecuteExcel4Macro to run on other page

ExecuteExcel4Macro "Sheet1.SHOW.DETAIL(1," & i & ",false)"

That's not valid syntax. You're melding VB concepts (the "Sheet1") to XL4
macro code. XL4 code for the most part only works on the active sheet. So
make Sheet1 active and delete that reference from the code.

--
Jim
"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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default ExecuteExcel4Macro to run on other page

"Jim Rech" wrote in message
ExecuteExcel4Macro "Sheet1.SHOW.DETAIL(1," & i & ",false)"


That's not valid syntax. You're melding VB concepts (the "Sheet1") to XL4
macro code.


That's what I thought but curiously it doesn't error.

XL4 code for the most part only works on the active sheet. So make Sheet1
active and delete that reference from the code.


I posted an example of how to do that within the sheet's deactivate event

Regards,
Peter T




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default ExecuteExcel4Macro to run on other page

That's what I thought but curiously it doesn't error.

Looks like if Excel doesn't see it as an XL4 command it just lets it pass.
This didn't error either:

Application.ExecuteExcel4Macro "NotSubWithThisName"

--
Jim
"Peter T" <peter_t@discussions wrote in message
...
"Jim Rech" wrote in message
ExecuteExcel4Macro "Sheet1.SHOW.DETAIL(1," & i & ",false)"


That's not valid syntax. You're melding VB concepts (the "Sheet1") to
XL4 macro code.


That's what I thought but curiously it doesn't error.

XL4 code for the most part only works on the active sheet. So make
Sheet1 active and delete that reference from the code.


I posted an example of how to do that within the sheet's deactivate event

Regards,
Peter T




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ExecuteExcel4Macro ... RFraley[_2_] Excel Programming 1 September 22nd 06 05:11 PM
Error on ExecuteExcel4Macro Page.Setup Jim Cone Excel Programming 3 September 13th 05 05:06 PM
ExecuteExcel4Macro: Help with this Shilps Excel Programming 0 May 21st 04 10:41 AM
ExecuteExcel4Macro Page.Setup Runtime Error Geoff Martin Excel Programming 1 January 27th 04 01:44 PM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"