Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Accessing VB functions (https://www.kinook.com/Forum/showthread.php?t=1048)

AndyChamp 05-12-2005 08:00 AM

Accessing VB functions
 
I want to use VBScripts' DateDiff function to get the current day as number of days from a base date. This will be a field in our version number. However, although I can access the Year & Day functions, I can't get DateDiff. Is there aa list anywhere of which functions I can use?

kinook 05-12-2005 09:34 AM

DateDiff is available from VBScript. The following code works in a Run Script step:

Builder.LogMessage DateDiff("d", Now, #1/1/2006#)

The available VBScript functions are documented here:
http://msdn.microsoft.com/library/en...riVBScript.asp

AndyChamp 05-12-2005 09:47 AM

OK, that helps - but as a VBScript novice I'm still stuck!

The output I'm getting is now

Building project step 'Increment Build number'...
234
497
Error at Line 5, Column 1 (Object required: 'DateDiff(...)')

The script fragment is

' set the version number for the various features
Builder.LogMessage DateDiff("d", Now, #1/1/2006#)
'Set Origin = DateValue("1/1/2004")
Builder.LogMessage DateDiff("d", #1/1/2004#, Now)
set ourday = DateDiff("d", #1/1/2004#, Now)

It looks rather as if, despite the error complaining about DateDiff, it's some kind of type incompatibility. Any more help please?

kinook 05-12-2005 09:52 AM

Remove the set in the line

set ourday = DateDiff("d", #1/1/2004#, Now)

The Set statement is used only when assigning object values (a VB-ism). DateDiff just returns a number.

AndyChamp 05-12-2005 10:52 AM

That's it, thanks very much!

(I knew there was a good reason why I never use VB)


All times are GMT -5. The time now is 09:48 AM.


Copyright © 1999-2023 Kinook Software, Inc.