Website Upgrade Incoming - we're working on a new look (and speed!) standby while we deliver the project

Tips on using this forum..

(1) Explain your problem, don't simply post "This isn't working". What were you doing when you faced the problem? What have you tried to resolve - did you look for a solution using "Search" ? Has it happened just once or several times?

(2) It's also good to get feedback when a solution is found, return to the original post to explain how it was resolved so that more people can also use the results.

VBA for MSProject

10 replies [Last post]
Mike Thornley
User offline. Last seen 15 years 6 weeks ago. Offline
Joined: 30 Sep 2005
Posts: 6
Groups: None
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

Replies

Marcio Sampaio
User offline. Last seen 12 years 38 weeks ago. Offline
Joined: 7 Nov 2005
Posts: 658
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.
Michael Bonandrini
User offline. Last seen 9 years 15 weeks ago. Offline
Joined: 20 May 2006
Posts: 18
Groups: None
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
Marcio Sampaio
User offline. Last seen 12 years 38 weeks ago. Offline
Joined: 7 Nov 2005
Posts: 658
On Amazon u can find books about VBA for MSP.

Regards.
vinod raturi
User offline. Last seen 7 years 9 weeks ago. Offline
Joined: 14 Aug 2006
Posts: 57

Hi Michael & Zhang

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

regards,
Zhang Haixiang
User offline. Last seen 4 years 33 weeks ago. Offline
Joined: 14 Apr 2005
Posts: 250
Groups: None

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
Michael Bonandrini
User offline. Last seen 9 years 15 weeks ago. Offline
Joined: 20 May 2006
Posts: 18
Groups: None
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
Zhang Haixiang
User offline. Last seen 4 years 33 weeks ago. Offline
Joined: 14 Apr 2005
Posts: 250
Groups: None
you can start with MS-Project vba help file. there are a lot of sample code.
vinod raturi
User offline. Last seen 7 years 9 weeks ago. Offline
Joined: 14 Aug 2006
Posts: 57

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,
Mike Thornley
User offline. Last seen 15 years 6 weeks ago. Offline
Joined: 30 Sep 2005
Posts: 6
Groups: None
Excellent, thanks very much.
Hannes de Bruyne
User offline. Last seen 2 years 37 weeks ago. Offline
Joined: 25 Jul 2005
Posts: 154
Groups: None
MyRow = Application.ActiveCell.Task.GetField(pjTaskID)

regard
Hannes de Bruyne