

Your one line subroutine should look like the code example below: MsgBox ("Hello World! This is my first VBA script in MS Project!") Type the following code in the subroutine section

Select Insert | Procedure, enter HelloWorld into the Name field, and select the Sub Type radio button ( Figure C).Ĭlick OK, and the HelloWorld subroutine will appear. Step 4: Create the Hello World subroutine. This is the blank code screen where you'll paint your Hello World masterpiece. Visual Basic Editor (Click the image to enlarge.) Step 3: Double-click the ThisProject(HelloWord.mpp) file (Figure B). Step 2: Click the Developer tab and click the Visual Basic icon (Figure A). We will be using the schedule in future tutorials. Step 1: Open Microsoft Project.Ĭreate a sample schedule and save the file as HelloWorld.mpp. Let's start with the ever appropriate Hello World example. In my next several TechRepublic posts, I'll introduce you to some simple VBA examples that you can apply to your projects. For the project management community, there isn't a lot of material available that provides realistic examples on how to apply Visual Basic with your Microsoft Project schedule. Even though I don't write code for a living, I still like to apply Visual Basic to my projects.Ī quick Google search will reveal thousands of sites dedicated to VBA programming with Excel and Visual Basic. Eventually, I handed in my programming hat for a project management role and started managing products rather than creating them. Three years later, I was writing Visual Basic applications as an IT intern. Like most aspiring technologists, I found programming fun and, after learning I could get paid to work with computers, I jumped right in. I started fiddling with Visual Basic nearly 20 years ago in Mr.
