Quick Excel Automation Question

I have read the excel automation tips and tricks but have 2 very easy questions not covered there. When writing from Navision to Excel: 1) I need to format a cell in Excel as a number, it is currently in there as currency ($) 2) I need to format a date as DD/MM/YYYY in Excel it is currently coming over as DD/MM/YY

Hi Jason, You can use: Sheet.Range(‘A1:A2’).NumberFormat := ‘#,###.##’ to format cells A1 and A2 as numbers. Sheet.Range(‘A1:A2’.Numberformat := ‘DD/MM/YYY’ wil give the format DD-MM-YYY. Why i don’t know ! When i am looking for the code, i usaly record a macro in Excel, an then look at the VBA-code. Edited by - ClausJohnsen on 2002 Aug 06 07:52:56

The slash (/) in a date format string will be replaced by the date separator of the current localization setting (which can be changed in the system configuration panel of Windows). If your date separator is ‘-’, then the slash will print as such. – Heinz Herbeck Waagner-Biro AG, Vienna, Austria