AndrewMozley
Programmer
An application offers the option of sending a report (a Profit and Loss account) to Excel using Excel Automation.
One of the boxes is the name of the month for which the report is produced, so April 2021.
The Excel application oExcel has been opened within the application; a workbook oWorkbook has been added and worksheet oSheet has been added to the workbook.
The application wants to put April 2021 into cell A2.
I first tried (effectively)
This does not quite achieve the result. Some automatic ‘character recognition’ is taking place : The value of the cell in the Excel data-entry box is shown as 01/04/21, and the value in place on the sheet shows Apr-21. And when I examine Format | Cells | Number this shows that this is set as Custom | mmm-yy. which is not what I wanted.
It is true that you can get round this by preceding the character string with a space. So :
But is there a way of preventing this helpful (but unwanted, in this case) feature of Excel Automation?
Thanks. Andrew
One of the boxes is the name of the month for which the report is produced, so April 2021.
The Excel application oExcel has been opened within the application; a workbook oWorkbook has been added and worksheet oSheet has been added to the workbook.
The application wants to put April 2021 into cell A2.
I first tried (effectively)
Code:
oSheet.Range("A2").value = “April 2021”
This does not quite achieve the result. Some automatic ‘character recognition’ is taking place : The value of the cell in the Excel data-entry box is shown as 01/04/21, and the value in place on the sheet shows Apr-21. And when I examine Format | Cells | Number this shows that this is set as Custom | mmm-yy. which is not what I wanted.
It is true that you can get round this by preceding the character string with a space. So :
Code:
oSheet.Range("A2").value = “ April 2021”
But is there a way of preventing this helpful (but unwanted, in this case) feature of Excel Automation?
Thanks. Andrew