OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

conversion

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
venkat
Power User
Power User


Joined: 11 Nov 2003
Posts: 64

PostPosted: Tue Jan 27, 2004 6:18 am    Post subject: conversion Reply with quote

Dear All,

i have written macro which will pick up values from the cells.
If i say "oCell.String", it returns string value - no issues
"oCell.Value", it returns numeric value - no issues
but if i want the date then
what i have done is
i declared a variable of date format, then assigning the cell value, it works some times also it fails saying that "Data type mismatch"
ie
dim varDate as Date
varDate = oCell.String

My query is how to get the date value directly from the cell.

Regards
Venkat
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Tue Jan 27, 2004 9:04 am    Post subject: Reply with quote

I think it's :
dim varDate as Date
varDate = oCell.value 'instead varDate = oCell.value
print(CStr(varDate))

seems to work for me.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Tue Jan 27, 2004 9:13 am    Post subject: Reply with quote

Embarassed i have done a fault in the previous post (in the comment)
try :
Code:

dim varDate as Date
varDate = oCell.value 'instead varDate = oCell.string
print(CStr(varDate))

_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group