Excel-Question...once again

Hi All! I’m not sure if this was not asked before…forgive me if it’s so! I want to export some data to Excel. Everything works fine, but i have problems with two things: When i export the value of a code-field leading zeros are deleted by Excel, for example: 012345 becomes 12345 Is there a solution out there? Is there a possibility to mark all columns and use the function “Optimal width”? Thanks in advance, Frank

Hi FPulsfort I had also faced this problem. The reason for this problem is excel consider this value as numeric and truncate trailing Zeros. The solution Which i used is as put a ’ mark before the code value. Then excel think this as a string field. And this character doesn’t appear in excel column. Eg. MycodeValue = ‘’’’ + MycodeValue //Then you can write this value into excel. Regards Joseph Mathew Edited by - joseph_mathew on 2001 Jun 15 15:07:46

Thanks Joseph, It works fine. Does anybody know a solution for my second question about the “optimal width”? Regards Frank

xlRange.columns.AutoFit; ------- With best regards from Switzerland Marcus Fabian