PhysiologyWeb Logo  Search
Share on Facebook Share on Twitter Share on LinkedIn Share on Pinterest Email Copy URL
PhysiologyWeb Loading...

Microsoft Excel Automation with Delphi
Let's face it! It is hard to imagine life and work without Microsoft Excel. While other spreadsheet tools are available, Excel has dominated this space for over two decades. So many companies (large and small) have unsuccessfully tried to challenge Microsoft's reign in this area. While web-based spreadsheets are gaining in popularity, the greater emphasis on privacy, information security, and accessibility standards will ensure that the majority of personal and commercial spreadsheets will, for now, continue to live in Microsoft Excel.
Here is a collection of Delphi lines of code that we use routinely to automate Excel. These have helped us tremendously with streamlining repetitive tasks. The key requirement for using these code lines is that you have Microsoft Excel already installed on your computer. We have tested our code with Delphi 6, Delphi XE, and Delphi 10.1 Berlin. Our code is for the Windows operating environment. We have not, and do not plan to, adapt the code for other operating environments. The code works well with Office 365 version of Excel, however, some our code has been in use since we were using Office 2010 (and continues to work well). We hope these will be useful to you. If you find errors, encounter unhandled errors/exceptions, or have suggestions, please let us know.
As you browse through the lines of code, please remember that an Excel file is also referred to as an Excel workbook. An Excel worksheet is what many people commonly refer to as an Excel tab. By default, a new workbook has one worksheet (used to be three in earlier versions of Excel), but a workbook can contain many worksheets (limited only by the computer's available memory). See here for workbook and worksheet specifications and limits.
Excel File (i.e., Workbook) Operations

Excel Worksheet (i.e., Tab) Operations

Excel Row and Column Operations

Excel Cell Formatting Operations

Posted: Saturday, December 5, 2020
Last updated: Sunday, January 14, 2024