Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default OnTime Function Call

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default OnTime Function Call

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default OnTime Function Call

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
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
Find %ontime & SUMIF ontime ie: find matching sets within Range... Chris T-M Excel Worksheet Functions 3 October 10th 08 08:14 PM
Call Sub from Function? G Lykos Excel Programming 1 November 23rd 05 06:48 AM
OnTime function Max Potters Excel Programming 3 September 25th 04 05:59 PM
need a function (not macro with ontime) to record a snapshot of a changing cell Shannon Excel Programming 3 February 2nd 04 06:26 PM
Function Call Phil Hageman Excel Programming 4 October 9th 03 04:32 PM


All times are GMT +1. The time now is 02:29 PM.

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"