I started this as a question, because I added an excel export option to a report using automation to create a spreadsheet from a table that had memo fields.
The user got back to me saying the memos were truncated to 255 characters (not EXACTLY what he said, but you get my drift).
The text was often quite a bit longer than that, and I searched on here for a solution, couldn't quite find it. Then I looked at a similar thing I had done years ago
and found that if I created the excel using COPY TO ... XL5 and then tried to use automation to add the missing memo fields, they were truncated.
But, if I simply created a new spreadsheet using automation, then put all the fields in (including the memos), it was perfect.
No idea why:
Regards
Griff
Keep [Smile]ing
The user got back to me saying the memos were truncated to 255 characters (not EXACTLY what he said, but you get my drift).
The text was often quite a bit longer than that, and I searched on here for a solution, couldn't quite find it. Then I looked at a similar thing I had done years ago
and found that if I created the excel using COPY TO ... XL5 and then tried to use automation to add the missing memo fields, they were truncated.
But, if I simply created a new spreadsheet using automation, then put all the fields in (including the memos), it was perfect.
No idea why:
Code:
OEXCEL = CREATEOBJECT("Excel.Application")
OEXCEL.VISIBLE = .F.
OEXCEL.WORKBOOKS.ADD
OEXCEL.DISPLAYALERTS = .F.
OEXCEL.WORKSHEETS("Sheet3").DELETE
OEXCEL.WORKSHEETS("Sheet2").DELETE
OEXCEL.DISPLAYALERTS = .T.
OEXCEL.CELLS.SELECT
OEXCEL.SELECTION.COLUMNWIDTH = 12
OEXCEL.SELECTION.FONT.NAME = "Arial"
OEXCEL.SELECTION.FONT.SIZE = 8
SELECT TMPTQ
GO TOP
I = 2
OEXCEL.CELLS(1,1).VALUE = "Origin"
OEXCEL.CELLS(1,2).VALUE = "QueryNo"
OEXCEL.CELLS(1,3).VALUE = "MCI No"
OEXCEL.CELLS(1,4).VALUE = "Details"
OEXCEL.CELLS(1,5).VALUE = "Date Recd"
OEXCEL.CELLS(1,6).VALUE = "Date Issued"
OEXCEL.CELLS(1,7).VALUE = "Date required"
OEXCEL.CELLS(1,8).VALUE = "Date Recived Back"
OEXCEL.CELLS(1,9).VALUE = "Date returned to Origin"
OEXCEL.CELLS(1,10).VALUE = "Answer"
DO WHILE .NOT. EOF()
OEXCEL.CELLS(I,1) = TMPTQ.MADEBY
OEXCEL.CELLS(I,2) = TMPTQ.QUERYNO
OEXCEL.CELLS(I,3) = TMPTQ.MCINO
OEXCEL.CELLS(I,4) = TMPTQ.DETAILS
OEXCEL.CELLS(I,5).VALUE = DTOL(TMPTQ.DATERECD)
OEXCEL.CELLS(I,6).VALUE = DTOL(TMPTQ.ISSUDATE)
OEXCEL.CELLS(I,7).VALUE = DTOL(TMPTQ.RETNDATE)
OEXCEL.CELLS(I,8).VALUE = DTOL(TMPTQ.RETEDATE)
OEXCEL.CELLS(I,9).VALUE = DTOL(TMPTQ.RETURNNDATE)
OEXCEL.CELLS(I,10) = TMPTQ.FURTHER
I = I +1
SKIP
ENDDO
OEXCEL.CELLS.SELECT
OEXCEL.CELLS.VERTICALALIGNMENT= -4160
OEXCEL.SELECTION.ROWS.AUTOFIT
OEXCEL.SELECTION.COLUMNS.AUTOFIT
OEXCEL.RANGE("A2").SELECT
OEXCEL.DISPLAYALERTS = .F.
OEXCEL.ACTIVEWORKBOOK.SAVEAS("c:\temp\myfile.XLS")
OEXCEL.QUIT
RELEASE OEXCEL
Regards
Griff
Keep [Smile]ing
There are 10 kinds of people in the world, those who understand binary and those who don't.
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.