Once we know our simple script is working, we need to create a navigation bar so we can call it from the Microsoft Project Ribbon interface ( Figure E). The message box will display with the Microsoft Project file in the background. Step 5: Press F5 to Run the program (Figure D). 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. Step 3: Double-click the ThisProject(HelloWord.mpp) file (Figure B).įigure B Visual Basic Editor (Click the image to enlarge.) ![]() Step 2: Click the Developer tab and click the Visual Basic icon (Figure A). We will be using the schedule in future tutorials. Let’s start with the ever appropriate Hello World example.Ĭreate a sample schedule and save the file as HelloWorld.mpp. ![]() 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. Get started with Microsoft Project and Visual Basic programmingĪndrew Makar goes back to basics and offers simple VBA examples that you can apply to Microsoft Project schedules.
0 Comments
Leave a Reply. |