AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 2,072
- Office Version
- 2019
- 2010
- Platform
- Windows
Struck a problem in my macro... I have a string Variable (VarType=8). It's value is, e.g. 04 51 and IsDate tells me True.
It's not a real Date, it's a Time Duration (4 mins 51 secs). Excel may interpret it as a Date, but I don't want it to unless it's 'dd mmm yyyy' Format.
The variable is picked up from a text box, so I assume Vartype will always identify it as a string ?
I tried to have it fail (as a date) with CDate but that didn't work.
How best might I resolve this ? Perhaps just by LEN, but is there's a better way ?
Maybe IsDate can distinguish between a Time and Day-Month-Year somehow?
It's not a real Date, it's a Time Duration (4 mins 51 secs). Excel may interpret it as a Date, but I don't want it to unless it's 'dd mmm yyyy' Format.
The variable is picked up from a text box, so I assume Vartype will always identify it as a string ?
I tried to have it fail (as a date) with CDate but that didn't work.
How best might I resolve this ? Perhaps just by LEN, but is there's a better way ?
Maybe IsDate can distinguish between a Time and Day-Month-Year somehow?