My approach to VBA programming with Excel

As a Java developer it was hard for me to jump into something like VBA programming for Excel.  But one of the projects which I am working on,  demands some features for our application as our client wanted the excel as UI interface for our Java application.

Initially I found it hard to get accustomed to the VBA programming until I came across this book (just using it as reference). Its indeed an awesome book for those who are very new to VBA programming especially with excel. Quick to refer and was easy to understand.

Excel Programming: Your visual blueprint for creating interactive spreadsheets (Paperback) – by Jinjer Simon (Author)

But in ideal, real time scenarios, only referring some good books wouldn’t help. I was in need of something more especially,  something that could reduce my references to the excel object model and pace up my development on VBA. So necessity made me to come up with an innovative approach. It was simple, quick to execute and is eventually helping me in getting acquainted with the Excel Object Model.

Here is what I do.

Whenever I am finding hard to identify how a feature/action that can be performed on excel, is to be done through code (VBA),  lets take for example that I need a code which could show only  a specific range of cells on excel be highlighted in red color, I go ahead and open a new excel and record a macro with exactly performing the same activity (in this case highlight cell’s with red color). Once recorded, save the file with extension as .xla,  if required,  and open up the VB Editor so see the auto-generated code for the macro. Voila! I got the code using the Excel object model and go back to my real time project and use the code appropriately. 🙂

I do not know how much my approach makes sense , but I found the idea working out really well and saving me a lots of time and slowly I am understanding the Excel Object Model too. 🙂

About this entry