Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 16
Default Call sub from Personal.xls

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Call sub from Personal.xls

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 16
Default Call sub from Personal.xls

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   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 16
Default Call sub from Personal.xls

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


  #6   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 16
Default Call sub from Personal.xls

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   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 16
Default Call sub from Personal.xls

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
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
How to Call Functions in the Personal Workbook? SteveM Excel Programming 1 December 18th 07 03:07 PM
Custom button to call a macro in Personal David Walker Excel Programming 1 July 1st 06 11:45 PM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM
Call a sub statement in "Personal Macro Workbook" from "ThisWorkbo QC Coug Excel Programming 1 August 26th 05 07:09 PM
Personal macro workbook and personal.xls John Kilkenny Excel Discussion (Misc queries) 1 June 14th 05 09:43 PM


All times are GMT +1. The time now is 11:22 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"