Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am writing a VB.NET plugin for Excel. I want to call the
ApplicationObject.Ontime function to call another function after a specified time. AppObj.OnTime Now + TimeSerial(0, 0, 5), "MyCustom SubName" I tried putting the calling and called function in the same class but it throws an error. "Exception from HRESULT: 0x800A03EC." I also tried putting the called function in a Global Module but no success.. still the same exception. This thing works in a Macro( wherein i specify ThisworkBooK.<CALLED FUNCTION Name) Does the Ontime Function work in an application or just that it works in a Macro? If it does, what is the right way to call it? thanks for your suggestions. -Satin |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Satin,
This Now + TimeSerial(0, 0, 5) is what's causing your problems. Try something like this: Dim xlapp As New Excel.Application Dim xlwb As Excel.Workbook xlwb = xlapp.Workbooks.Open("D:\sample.xls") xlwb.Application.OnTime(Now.AddSeconds(5), "SubName") where SubName is a public Sub inside a module in the sample.xls file. -- Hope that helps. Vergel Adriano "Satin" wrote: I am writing a VB.NET plugin for Excel. I want to call the ApplicationObject.Ontime function to call another function after a specified time. AppObj.OnTime Now + TimeSerial(0, 0, 5), "MyCustom SubName" I tried putting the calling and called function in the same class but it throws an error. "Exception from HRESULT: 0x800A03EC." I also tried putting the called function in a Global Module but no success.. still the same exception. This thing works in a Macro( wherein i specify ThisworkBooK.<CALLED FUNCTION Name) Does the Ontime Function work in an application or just that it works in a Macro? If it does, what is the right way to call it? thanks for your suggestions. -Satin |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If xlwb is new, it won't have any macros to execute. How about either
creating from a template, or putting the macro in Personal.xls? Carl. On May 4, 7:22 am, Vergel Adriano wrote: Satin, This Now + TimeSerial(0, 0, 5) is what's causing your problems. Try something like this: Dim xlapp As New Excel.Application Dim xlwb As Excel.Workbook xlwb = xlapp.Workbooks.Open("D:\sample.xls") xlwb.Application.OnTime(Now.AddSeconds(5), "SubName") where SubName is a public Sub inside a module in the sample.xls file. -- Hope that helps. Vergel Adriano "Satin" wrote: I am writing a VB.NET plugin for Excel. I want to call the ApplicationObject.Ontime function to call another function after a specified time. AppObj.OnTime Now + TimeSerial(0, 0, 5), "MyCustom SubName" I tried putting the calling and called function in the same class but it throws an error. "Exception from HRESULT: 0x800A03EC." I also tried putting the called function in a Global Module but no success.. still the same exception. This thing works in a Macro( wherein i specify ThisworkBooK.<CALLED FUNCTION Name) Does the Ontime Function work in an application or just that it works in a Macro? If it does, what is the right way to call it? thanks for your suggestions. -Satin- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find %ontime & SUMIF ontime ie: find matching sets within Range... | Excel Worksheet Functions | |||
Call Sub from Function? | Excel Programming | |||
OnTime function | Excel Programming | |||
need a function (not macro with ontime) to record a snapshot of a changing cell | Excel Programming | |||
Function Call | Excel Programming |