View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel Macro Strings

Why not just use typename as I suggested and get the type in English.

Regards,
Tom Ogilvy

Dan E wrote in message
...
Brandon,

You could give VarType a try

Sub TMP_InstantLog()

Dim temp1, temp2, temp3
Dim PLCMonth, PLCDay, PLCYear, PLCDate
Dim curr_TMP
curr_TMP = 4

Channel = DDEInitiate("DSData", "TMP_DataRetrieve")
temp1 = CInt(DDERequest(Channel, "V30145:B"))
temp2 = CInt(DDERequest(Channel, "V30146:B"))
temp3 = CInt(DDERequest(Channel, "V30147:B"))
DDETerminate Channel

MType = VarType(temp1)
DType = VarType(temp2)
YType = VarType(temp3)

Debug.Print MType, DType, YType

vbEmpty 0 Empty (uninitialized)
vbNull 1 Null (no valid data)
vbInteger 2 Integer
vbLong 3 Long integer
vbSingle 4 Single-precision floating-point number
vbDouble 5 Double-precision floating-point number
vbCurrency 6 Currency value
vbDate 7 Date value
vbString 8 String
vbObject 9 Object
vbError 10 Error value
vbBoolean 11 Boolean value
vbVariant 12 Variant (used only with arrays of variants)
vbDataObject 13 A data access object
vbDecimal 14 Decimal value
vbByte 17 Byte value
vbUserDefinedType 36 Variants that contain user-defined types
vbArray 8192 Array


"Brandon" wrote in message
...
Sorry, I didn't really understand your post. I saw
the "what data type is date" but then you tested
something and said it worked so I thought you found out
yourself. Is there another way to test other than
just "isdate", because that is the only one I found in VB
Excel help. In my last post I showed the problem lies in
the format of the number I am retrieving from an outside
source. It is not a date, I tested the IsDate(temp1), but
I can't test if it is an Int with IsInt, or if it's a
string with IsString. Is there any other way I can find
out what data type the number is stored as? And even if i
do somehow find out, how can something just not be
converted to a String if it is some form of number? I
have never seen anything like this error in any
programming I have done before.
Thanks for any help you can still give me Tom.
-Brandon