Visual Basic(VB) Editor: It has been some while...

It has been some while since I wrote my last and my very first post.Today is 21th of July and today is the day where I'm about to start writing and share with you guys about what I've been learning so far on programming. I believe most programmer, they would probably start learning programming with VB which stand for Visual Basic. I'm myself learnt my very first code in VB and it is VB editor build in Microsoft Excel.So from today onward I will most likely share with you some basic application that can be build by using VB Excel Editor. Frankly speaking at first I'm totally zero about what is programming all about but with enthusiasm and interest of learning this computer language gradually I managed to understand some basic coding that would be beneficial to me as a naive beginner. So first, before I begin sharing what I've been learning so far about VB, it is good if I can briefly explain to you what is VB Excel editor and how you can get excess to it and hence get use to its environments.
<*Note - You must have Microsoft Excel 2003 in order to follow with my explanation and do some simple tutorial that I'm about to share>

Below are easy instructions on how you can get excess to VB editor build in Microsoft Excel:

> Open Microsoft Excel 2003 , Go to Tool/Macro/Visual Basic Editor Or simply hold on Alt and press F11. You will see a new screen pop up as shown below:



Here I'll briefly explain the functions of each of the toolbox and properties happen to have in this editor:

1) First you'll have Project Explorer and Project Window at default. Project Explorer simply visualize about the tree that you might encounter in your application such as Sheet,Workbook,UserForm, module and ClassModule while Project Window is where the properties of each elements lies in. First you will noticed that there's only a set of 3 sheets and also workbook represent once you open this editor. In order to add those UserForm and module all you have to do is simply Right Click your mouse in the Project Explorer and choose INSERT. There are 3 options all together which is UserForm, Module and ClassModule as you can see in the following diagram;-


Some Useful Definition and its Functions

  • UserForm - It is some sort like user friendly interface where the user can enter datas, key in inputs and thus evaluate those datas with just one click on a button created on that UserForm. To make it more clearer once you insert your first UserForm in the Project Explorer you will have a Toolbox where there's a bunch of options and command buttons that you can easily insert and place it on your UserForm. On the other hand your application will depend on how creative you create your Userform.

  • Module - Here is the place where your source code will be place. You can manage your module depending on how you construct your application.

  • In the "ToolBox" box there's some useful buttons and control tools that you can use to create your interface such as ;- Text, Label, Frame, MultiPage, CommandButton, ListBox, OptionButton, Combo Box and so on. For the sake of learning it is good if you can try to play around and see how this button and control tools does work.

2)Once you get use to this VB editor environment now is the time to do some simple coding and see how interesting VB programming can be. Your very first code will be "MsgBox" command.

Insert a module and type in;-

Sub MyFirstCode ( )

MsgBox "Hello World! My Name is....."

End Sub ( )

Hit the Play button in the top bar of VB editor.The result will be as below;-

3)Some important tips while writing your codes;

  • Bare in mind every time you start coding it must begin with Sub Module ( ) and end with End ( ).
  • Between this two codes here is where your main coding will take place.

This is just a very simple brief explanation about VB editor and a simple coding that a beginner can have. This is also a very first lesson that I have while learning programming with VB. Hope this post can give a glimpse to a newbies about what is VB language all about and its environment in Microsoft Excel. Stay tune and hopefully I'll come out with some more interesting coding in VB Excel and again sorry for my English..

Posted byMatt at 12:20 AM  

0 comments:

Post a Comment