Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HI,
I have a 4 workbooks which my users might want to access at the same time. I have a timer module that is used over all four books and runs from personal.xls. I would like to call a sub kept in the active workbook from within the timer module of personal.xls, Can anyone shed some light how I would achieve this. Many thanks Don |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Application.Run("workbook.xls!macro",arg1,arg2,etc )
|
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 19, 1:14*pm, Dave Peterson wrote:
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- Hide quoted text - - Show quoted text - Thanks for suggestion I'll post back to let you know if it worked. Thanks again |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 19 Jun, 17:36, don wrote:
On Jun 19, 1:14*pm, Dave Peterson wrote: 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- Hide quoted text - - Show quoted text - Thanks for suggestion I'll post back to let you know if it worked. Thanks again- Hide quoted text - - Show quoted text - Yes worked fine thanks Don |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Call Functions in the Personal Workbook? | Excel Programming | |||
Custom button to call a macro in Personal | Excel Programming | |||
Call Center Management: How to calculate 'cost per call' | Excel Discussion (Misc queries) | |||
Call a sub statement in "Personal Macro Workbook" from "ThisWorkbo | Excel Programming | |||
Personal macro workbook and personal.xls | Excel Discussion (Misc queries) |