View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default ActiveWorkbook pointer for Macros from PERSONAL.XLS

Hi robert,

You can then pass the name of the requisite sheet to the Sort1 routine
from the call statement, e.g.:


Should read:

You can then pass the name of the requisite sheet to the Sort1 routine from
the Run statement, e.g.:

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Robert,

I am now trying to run all macros FROM Personal.xls. Having followed some
of
the posts, I tried but I am still unable to point to the worksheet that
has
to be run.


One way :

Add an argument (ShtName) to the sort1 routine in Personal.xls:

Sub Sort1(ShtName As String)
Dim sh As Worksheet

Set sh = ActiveWorkbook.Sheets(shtName)

' Your procesing code

End Sub

You can then pass the name of the requisite sheet to the Sort1 routine
from the call statement, e.g.:

Sub Macro1()

'Do something
Application.Run "Personal.xls!Sort1", "MySheet"
'Do something elae

End Sub


---
Regards,
Norman