Source for VBA syntax

Andrew Collins 41 Reputation points

Is there a document or location where can one get all the syntax for VBA expressions? That is, a source document where one can drill down for all the properties, methods, enumerations etc for every object. For example, I am trying use VBA to place and format the properties of a pie chart in a worksheet, and by using online search engines I have found several excellent bits of advice from those who understand VBA better than I do. I have found the line “ActiveChart.SeriesCollection(1).Points(1).Format.Fill.Forecolor.rgb=”
which will get me well on the way to sorting out the segment colours, but where is the documentation for it? And where do I find the other things that SeriesCollection will let me do? I have used the F1 help function in VBA, which is rarely of any use. I have used the Object Browser in the Excel VBA window, which does not go deep enough. Intellisense, when it is available is helpful, but in this and many other cases it does not work. When the procedure is up and running, one can get some information from the Locals window, but that is no use while one is writing the procedure. I have a couple of very thick books on Excel programming, but they do not cover all situations. Recording a macro is a great way of finding the syntax, but again in this and many other cases, it does not actually record anything after the first action. I shall doubtless find online the correct format for this partiular problem, but where should I look for the definitive answer to all such questions?

0 comments No comments
{count} votes

Accepted answer
  1. Sam of Simple Samples 5,511 Reputation points

    The official documentation is at Language reference for Visual Basic for Applications (VBA). The formal syntax is available in a PDF at VBA Language Specification. The VBA Language Specification however answers the question about all the syntax for VBA expressions. I suspect that you are actually looking for something that explains VBA and that the documentation is inadequate for you.

    Look at Workbook.ActiveChart property. It is a Chart object. They have a Chart.SeriesCollection method that returns either a single Series object or a collection of Series objects. You can similarly drill down from there.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. 121 Reputation points

    You may also find the following website useful.
    It contains a complete list of all the VBA built-in functions and operators.

    0 comments No comments