>>hi all,
>>I have an application that creates an excel file and have 2 problems.
>>I need to format the cels to save them work so that they can enter something like 01/98 without excel trying to be clever and turning that into a date. I have tried the following
>>
>>OleApp.cells(lnCounter,4).NumberFormat = "@"
>>
>>but that does not work
>
>You have the same problem when you enter data manually.
>
>Solution 1: Add a single quotation mark to the beginning of the text. This will not be shown - it is interpreted by Excel to mean that remaning text is... well, text, not a date, formula, or anything else.
>
I have added in a ' when my program is creating the file but that has not worked, elcel is still converting 12/97 to a date
>Solution 2: Format the cell as a text,
before you enter the value.
>
>>My second problem is when reading the file back in I have a column that has a formula in it sum(G1*H1) but when I read it in I get errors. Normally when i read in from excel there is not a formula in the cell and this is the first time doing this, any pointer please.
>>~M
>
>How do you read it in? With Automation, you should be able to work with the Cell.Value property.
the code i use is
mpage = OleApp.cells(lnCounter,4).value
where mpage is a character variable trying to read in the page a user enters in the formal 9/97, 10/97... etc. lncounter is a variable holding the row that is currently being looked at. This reads in A1*B1 but not the result in the cell which is a number
~M
Go raibh maith agat
~M