View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Call sub from Personal.xls

Maybe...(untested)

Option Explicit
Sub testme()

Dim ok As Boolean
Dim wkbk As Workbook

ok = False
For Each wkbk In Application.Workbooks
On Error Resume Next
Application.Run "'" & wkbk.Name & "'!macronamehere", "parm1"
If Err.Number < 0 Then
Err.Clear
Else
ok = True
Exit For
End If
On Error GoTo 0
Next wkbk

If ok = False Then
MsgBox "Failed!"
Else
MsgBox "may it worked???"
End If

End Sub




don wrote:

On Jun 18, 3:09 pm, don wrote:
On Jun 18, 2:25 pm, Smallweed
wrote:

Application.Run("workbook.xls!macro",arg1,arg2,etc )


Thanks for reply but as mentioned in op this could be one of four
workbooks (in fact more) so I would not know which workbook.xls to
specify. Can I use wildcards?

Don


Any other thoughts please?

Don


--

Dave Peterson