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)
-   -   vbld_AllMacros.Item("MyMacro").Value --> Datatype (https://www.kinook.com/Forum/showthread.php?t=1553)

FUJE 02-14-2006 09:40 AM

vbld_AllMacros.Item("MyMacro").Value --> Datatype
 
hi

i have a problem with a visual script integration.
generally i have to know what datatype with the expression vbld_AllMacros.Item("MyMacro").Value is returned back.

my code:

Dim RelDate
RelDate = vbld_AllMacros.Item("MyMacro").Value
dYear = Year(actDate)

my error:
Error at Line 75, Column 2 (Type mismatch: '[string: "01.12.2005"]')

if i call a external script file and get the variable RelDate via
RelDate = WScript.Arguments(2) there occurs no error.


--> so what kind of datatype is returned by the vbld_AllMacros.Item("MY_Macro").Value, or how can i convert it?

kinook 02-14-2006 10:14 AM

The variable type of a macro depends on how the value was assigned (it is stored in a Variant data type). You can check it like this:

Dim RelDate
RelDate = vbld_AllMacros.Item("MyMacro").Value

Builder.LogMessage "MyMacro value = '" & RelDate & "'"
Builder.LogMessage "MyMacro type = " & TypeName(RelDate)

It appears that in your case, it is a string with the value

01.12.2005

In the US English locale, the VBScript Year function is unable to parse a string in that format (it can handle a format like "01/12/2005"). You need to store or convert the date in a format that VBScript knows how to parse for your locale.


All times are GMT -5. The time now is 06:25 PM.


Copyright © 1999-2023 Kinook Software, Inc.