HELP! Excel changes field properties

kuipers78

Registered User.
Local time
Today, 07:40
Joined
May 8, 2006
Messages
45
Hello,

I'm trying to export data to an Excel spreadsheet (using VBA), which usually works fine. But now I have the following problem:
When I try to export a date, Excel defines it's own field property and mask to it. And this means a date notation I don't wanna use!
So, I've tried to convert the date to a string or give it a certain date format (using VBA, works fine in Access), but when I export it to Excel the format keeps changing :(
How can I avoid this by letting Excel know that the date has to be treated as plain text (in the field properties)????

Here is my code:

Code:
Dim ExDate as String

Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Visible = True

ExDate = Format(now, "dd\-mm\-yyyy")

ExcelSheet.ActiveSheet.cells(1, 1).Value = ExDate

Also tried (didn't work either):

Code:
ExcelSheet.ActiveSheet.cells(1, 1).Value = Format(ExDate, "dd\-mm\-yyyy")

Any help will be greatly appreciated!
 
Haven't worked with excel in quite awhile now, but doesn't putting ' in front of something make excel see it as text?
 
I think that you have to use TEXT(value,Format...)

Brian
 

Users who are viewing this thread

Back
Top Bottom