Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2007 VBA - Scheduled function call with refferenced variables.

Status
Not open for further replies.

Pejayuk

IS-IT--Management
Dec 22, 2003
7
GB
I want to be able to schedule a function call passing the workbook reference to the called function.
The closest I have found is the applicaton.ontime option but this will not allow the passing of the workbook reference.
I am calling this from a class addin

Code:
Option Explicit
Private WithEvents XLApp As Application
Private Sub XLApp_NewWorkbook(ByVal wb As Workbook)
	XLApp.OnTime Now + TimeSerial(0, 0, 10), "My10secondtest wb"
End Sub

There is also the possibility that more than one workbook will be opened at the same time so using the ontime method will cancel one of them out.
Does anyone have any idea how to do this with a workbook reference and with more than one workbook open.
Many thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top