Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.vc,microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am getting a #VALUE error in Excel when I try to access the following simple GetTime function via =get_c_system_time(NOW()). Can anyone shed some light please. Regards, Chris Adams (Apologies if its long - I thought maybe its the best way of illustrating the problem.) My VC code: =========== #include <windows.h #include <time.h #define SECS_PER_DAY (24*60*60) //================================================== ============== // Returns the time of day rounded down to the nearest second as // number of seconds since the start of the day //================================================== ============== long current_system_time(void) { time_t time_t_T; struct tm tm_T; time(&time_t_T); tm_T = *localtime(&time_t_T); return tm_T.tm_sec + 60*(tm_T.tm_min + 24* tm_T.tm_hour); } //================================================== ============== // Returns the time of day rounded down to the nearest second as a // fraction of 1 day, ie. compatible with Excel time formatting. // // Wraps the function long current_system_time(void) providing a // trigger for Excel using the standard calling convention for // Win32 DLLs. //================================================== ============== double _stdcall get_system_time_C(long trigger) { return current_system_time() / (double) SECS_PER_DAY; } My Excel Code: ============== Declare Function get_system_time_C Lib "GetTime.dll" _ (ByVal trigger As Long) As Double Function Get_C_System_Time(trigger As Double) As Double Get_C_System_Time = get_system_time_C(0) End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Microsoft Visual Basic Error in Excel | Excel Discussion (Misc queries) | |||
Excel Visual Basic Error | Excel Discussion (Misc queries) | |||
Visual Basic Error when opening Excel | Excel Discussion (Misc queries) | |||
Visual Basic I/O error when opening Excel file | Excel Worksheet Functions | |||
Excel - Visual Basic Complie error | Excel Programming |