Learning VBA

I am in the process of learning VBA. As I gat more into this, I realize that there seem to be many different flavors of VBA out there.

Specifically, I am trying to learn VBA for MicroStation, A CAD program developed by Bentley. I am following a book titled:

"Learning MicroStation VBA", by Jerry Winters, 2006 Bentley Institute Press.

Over all it's a good book, but sometimes, it seems to be written for a reader that already knows VBA, which I do not.

I know the Bentley Program MicroStation very well, so when the VBA book references connecting to some bit of the program, I know pretty well whet it is talking about. However, it's the VBA I am having problems with, specifically when the book tells me to "Write some code", and I do, but it then does not offer any answers to the errors I get when I try the code out.

My Question is:

Is there some additional, fundamental VBA book or documentation I could reference to help me along in explaining what this book seems to be lacking in. I feel like I should know VBA better but when I look for additional information, it's always VBA for Excel or Word, or something else.

Thanks in advance
LVL 1
RKoonsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
The VBA language is consistent between applications.

However library differences between applications are inevitable. E.g There is no such thing as a WorkSheet (Excel) or a Slide(Powerpoint)Word.

In most Microsoft applications, while in the VBA IDE, you can add a reference to the particular application object library and then get access to the F1(Help) or the F2(Object browser)  for that particular application.
0
byundtMechanical EngineerCommented:
VBA for Excel came first, and gradually spread out to the other Office applications, plus a handful of licensees. VBA was originally a subset of Visual Basic 3 (I believe), but features were swapped back and forth through Visual Basic 6. If you got a book for Visual Basic 6, that would probably fill in the missing gaps from your MicroStation VBA book. Excel 2003 had excellent on-line help for the VBA. Later versions have been reducing the amount of on-line help, and Excel 2013 got rid of it altogether, shunting users off to the MSDN website.

I find the most difficult part of coding in VBA to be wrapping your head around the object model for the application. Excel is based on ranges and worksheets where Word is based on paragraphs and sections. You absolutely have to start thinking in terms of the object model to get anywhere. If you approach Word VBA thinking in terms of words, sentences and pages there will be much gnashing of teeth, for example.

I urge you to use Option Explicit at the top of every module sheet. In Excel, there is a checkbox for it (Require variable declaration) in the VBA Editor under Tools...Options...Editor. Having done that, I then urge you to declare every variable that you use as something. Even though you can declare variables as Variant and avoid the need to exactly specify what you are dealing with--doing so will cause problems for you in debugging. Furthermore, by declaring a variable as something, you gain the advantage of IntelliSense to suggest the properties and methods available for your object.

One very common run-time error is "Subscript out of range". This usually means that the object in question doesn't exist yet, or that its name is spelled differently.
0
Steven CarnahanNetwork ManagerCommented:
There is a forum at http://communities.bentley.com/communities/everything_else_community/f/289/t/47014.aspx that talks about errors in the book.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RKoonsAuthor Commented:
Thanks for your responses. I was especially rewarded to see in the forum that lots of people seem to be having issues with Chapter 5, which is the first chapter that has us doing code, and just happens to be a complete mess.

I will venture further out to see what else I can find to supplement this text and hope that chapter 6 is better.

Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.