Basic Syntax and Examples Tutorial [closed]

2019-01-15 16:41发布

问题:

At work I work closely with MS-Office. I have managed to generate some scripts that perform various tasks. While I can port functions to VBA with some difficulty, I do not fully understand the foundations of the VBA language.

Items for which I seek basic syntax and examples include: 'hello world' program, loops, flow control, variable declaration, variable type conversions, Objects (if possible), file/user input/output, when 'with' block can be used, and so on.

Could someone provide me with a link to a VBA tutorial, perhaps with the details of the above items?

回答1:

The versions of VBA post Office 2000 are almost identical to VB6. This MSDN site is a great place to start. The VB6 resource center might also be of use.



回答2:

MSDN: Developing Office Applications Using VBA

If you haven't taken a look at it already, you can learn a lot from Visual Basic help within Office. To access it open an Office program and press Alt+F11 to open the Visual Basic Editor. Then press F1 or navigate to Help -> Microsoft Visual Basic Help. Also, as Mitch mentioned, if you learn the basics of VB6 you can use the same syntax for VBA.



回答3:

I think you will find this video tutorial pretty helpful:

http://developresource.weebly.com/10/post/2011/11/vba.html

And there are some other great stuffs you can find there so have a try :)



标签: vba ms-office