Skip to content

VBA for MSProject

Mike ThornleyMember for 21 years
Created
10
4
0
I am writing a macro for MSProject and have difficulty in finding a VBA instruction to read data in the existing project. Specifically I am searching for a specific activity name and then want to know which Row I am looking at:

Dim MyRow As Single
Find field:="Name", Test:="contains", Value:="End", _ Next:=True, MatchCase:=False
MyRow = ???????

Can anyone help out?

Mike

10 replies

Oldest first
  1. 0
    Hannes de Bruyne ·
    MyRow = Application.ActiveCell.Task.GetField(pjTaskID)

    regard
    Hannes de Bruyne
  2. 0
    Mike Thornley ·
    Excellent, thanks very much.
  3. 0
    Vinod Raturi ·

    hi all ,

    I am quite new in planning by software. I am interested in learning VBA , can someone tell me where i can find free tutorial on net for VBA .

    it must be quite interesting to make your own commands , as i find people discussing here in this forum.

    thanks,
  4. 0
    Zhang Haixiang ·
    you can start with MS-Project vba help file. there are a lot of sample code.
  5. 0
    Michael Bonandrini ·
    Get yourself the book "Power programming for Excel with VBA"... I used this book to learn VBA. If you can use this book you’ll understand how to use VBA in MS Projects without any trouble whatsoever. It’s comprehensive enough for you to understand MSProjects VBA without the need for a book. Alternatively go to www.vbexplorer.com, download the tutorials and go through them (otherwise just ask & I’ll assist where possible)

    If anyone questions what I’m saying... feel free to ask for assistance & I’ll tell.

    Regards

    Michael Bonandrini
    Planning Engineer
  6. 0
    Zhang Haixiang ·

    If you can use Basic, then VBA is easy.
    In Excel/MSP try to record macro,then learn the code using the help file.

    It’s important to understand the object model (including object,property,method, event...), it’s the main different between basic & VBA
  7. 0
    Vinod Raturi ·

    Hi Michael & Zhang

    Thanks for your guidance , i would go as per your suggestion.

    regards,
  8. 0
    Marcio Sampaio ·
    On Amazon u can find books about VBA for MSP.

    Regards.
  9. 0
    Michael Bonandrini ·
    Hi Marcio

    There’s a book for MSProjects that’s called the "Microsoft Projects 2002 Bible" by Hungry Minds inc. This book isn’t specifically for VBA for Microsoft Projects, but there is a couple of chapters dedicated to VBA (but you will struggle if you don’t have any serious VBA experience).

    I still recommend getting a book on VBA programming for Excel first, this will guide you properly (especially considering the multitude of books that you can get on Excel VBA).

    I would recommend getting a book called "Excell 2002 Power programming" or a later version. You can find out about this book on www.j-walk.com Once youve gone through the book in detail, you won’t need to get a book on Microsoft Projects, because you will understand it immediately.

    I hope the above helps
  10. 0
    Marcio Sampaio ·
    Thanks Michael;

    I agree with u.

    I already did an Excel x VBA curse. After that, i bought a VBA for MS Project book and learned by myself.

    Regards.

Log in or join to reply

ProjectControls.com is free to join. Members can post questions, reply, vote and follow discussions.

Existing members: your original username and password still work. Forgot password?