LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.vc,microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default #VALUE error in Excel using Visual C++ DLL

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
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
Microsoft Visual Basic Error in Excel mack Excel Discussion (Misc queries) 0 August 24th 06 07:27 PM
Excel Visual Basic Error cmar Excel Discussion (Misc queries) 2 June 10th 06 12:13 AM
Visual Basic Error when opening Excel Mary Excel Discussion (Misc queries) 1 February 1st 06 08:11 PM
Visual Basic I/O error when opening Excel file SK Low Excel Worksheet Functions 0 November 24th 05 09:52 AM
Excel - Visual Basic Complie error Chad[_11_] Excel Programming 10 July 30th 04 11:32 PM


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