Hi Martin,
IME if you need full control over what goes on in Excel it's best to
automate the Excel object model and address the cells directly, rather
than to treat the worksheet as a table.
That said, how are you creating the worksheet and inserting the field
names? Without having tested it thoroughly I get the impression that if
you create a worksheet, put the field names in the top row and then
execute queries to append the data you'll get the numbers-as-text effect
you're having. But if you create the worksheet with a make-table query
that returns the appropriate field types, subsequent append queries will
append number field values as numbers. This seems to be the case even if
the initial make-table query created a table with zero rows.
Here are the queries I just tried this with:
Make-table query that returns no records:
SELECT ID, FirstName, LastName INTO
[Excel 8.0;HDR=Yes;Database=C:\Temp\XX.xls;].[Sheet1]
FROM AddrNew WHERE False;
Append query:
INSERT INTO
[Excel 8.0;HDR=Yes;Database=C:\Temp\XX.xls;].[Sheet1]
SELECT ID, FirstName, LastName
FROM AddrNew;
>I have a fairly complex export routine that outputs data from access (an adp
>actually) to a
[quoted text clipped - 18 lines]
>
>M
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Martin Newman - 14 Aug 2004 17:03 GMT
Well actually I am not even using a query - I am picking the data for the
spreadsheet up from loads of places in a way that I really can't even begin
to think how I would do in (T)SQL - it;s an adp by the way, the make table
query isn't an option AFAIAA - so I am using ADO addnew and filling the
recordset manually.
I am much less familiar with the Excel object model but what you are saying
is that I should be able to use that to ebnsure numeric values are numeric -
any clues, anyone, on how I do that? This may of course be obvious but I
have rarely played with Excel at the programatioc level.
Thanks for your helpful reposnse, John
M
> Hi Martin,
>
[quoted text clipped - 52 lines]
>
> Please respond in the newgroup and not by email.
Martin Newman - 14 Aug 2004 17:58 GMT
Forget that question - just seen one of your other postings
> Well actually I am not even using a query - I am picking the data for the
> spreadsheet up from loads of places in a way that I really can't even begin
[quoted text clipped - 69 lines]
> >
> > Please respond in the newgroup and not by email.
John Nurick - 14 Aug 2004 19:11 GMT
Glad to help.
>Forget that question - just seen one of your other postings
>
[quoted text clipped - 81 lines]
>> >
>> > Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.