Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oftentimes, you really have to know your data to make those good
assumptions/decisions. Paul wrote: This is what ended up working: Dim temp as Variant temp = xlapp.ExecuteExcel4Macro(b & c.Address(1, 1, xlR1C1)) If IsDate(temp) Then c.value = "'" & temp else c.value = temp end if This would of course break the function if it were really supposed to come through as a date, but for this application, it worked. Thanks for the help! On Oct 3, 6:09 pm, Dave Peterson wrote: And if it does work ok, but you want to check before you convert to text: Dim res as variant res = xlapp.ExecuteExcel4Macro(b & c.Address(1, 1, xlR1C1)) if isdate(res) then c.value = res else c.value = "'" & res end if (or add more significant checks.) Paul wrote: I am using Harlan Grove's PULL function to grab data from other spreadsheets, and it mostly works except that some strings that look like dates get converted to numbers and therefore don't work with VLOOKUP and the like. For example, "06-6107" gets changed to 1536728. It seems that this is happening in this bit of code: For Each c In r c.Value = xlapp.ExecuteExcel4Macro(b & c.Address(1, 1, xlR1C1)) Next c The Value property is a Variant, so in the conversion the string is interpreted as a date. Is there any way to force that to be converted a Variant/String instead of Variant/Double? Thanks, Paul -- Dave Peterson -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
String to Variant incorrect conversion | Excel Worksheet Functions | |||
DIM Variant / String | Excel Programming | |||
Retain Variant / String value | Excel Programming | |||
basic variant to array conversion | Excel Programming | |||
Variant to String | Excel Programming |