Dim Rsrc As Resource
' Set Resource Booking Type to Proposed
For Each Rsrc In ActiveProject.Resources
ActiveProject.Resources(Rsrc).bookingtype =
pjBookingTypeProposed
MsgBox (Rsrc.Name)
Next Rsrc
You'll notice that it doesn't want to capitalize the "bookingtype"
portion, even though it recognizes it and prompts me for the
pjBookingTypeProposed. I tried using the SetField method, but those
only gave me 1101 errors. this one gives me the run-time error 1004
"an unexpected error occurred with the method."
Based on other threads here, I couldn't figure out why this code did
not work. Any thoughts?
Other threads on topic:
http://groups.google.com/group/microsoft.public.project.developer/browse_thread/thread/501bf464bb6229c9/337489bdfbf94c04?lnk=gst&q=bookingtype&rnum=1#337489bdfbf94c04
http://groups.google.com/group/microsoft.public.project.developer/browse_thread/thread/cb4ef2d962e329e5/df7fb619b17aceae?lnk=gst&q=bookingtype&rnum=9#df7fb619b17aceae
Thank you!
No comment on the bookingtype property as I'm not in a position to test at
the moment, but your code should read:
Dim Rsrc As Resource
' Set Resource Booking Type to Proposed
For Each Rsrc In ActiveProject.Resources
if not Rsrc is nothing then 'Test for blank resource
Rsrc.bookingtype = pjBookingTypeProposed
MsgBox (Rsrc.Name)
End If
Next Rsrc
--
Rod Gill
Project MVP
Project VBA Book, for details visit:
http://www.projectvbabook.com
NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
----------------------------------------------------------------------------------------------------
"Sean" <sean0m...@gmail.com> wrote in message
news:1189796164.2...@r29g2000hsg.googlegroups.com...
--Sean
On Sep 14, 2:06 pm, "Rod Gill" <rod AT project-systems DOT co DOT nz>
wrote:
> Hi,
>
> No comment on the bookingtype property as I'm not in a position to test at
> the moment, but your code should read:
> Dim Rsrc As Resource
>
> ' Set Resource Booking Type to Proposed
> For Each Rsrc In ActiveProject.Resources
> if not Rsrc is nothing then 'Test for blank resource
> Rsrc.bookingtype = pjBookingTypeProposed
> MsgBox (Rsrc.Name)
> End If
> Next Rsrc
>
> --
>
> Rod Gill
> Project MVP
>
> Project VBA Book, for details visit:
> http://www.projectvbabook.com
>
> NEW!! Web based VBA training course delivered by me. For details visit:
> http://projectservertraining.com/learning/index.aspx
>
> ----------------------------------------------------------------------------------------------------
>
> "Sean" <sean0mich...@gmail.com> wrote in message
>
> news:1189796164.2...@r29g2000hsg.googlegroups.com...
>
> > I'm working on a macro to close out a project. So far, I've had no
> > problem zeroing out remaining work. But we also want to change each
> > resource's booking type to 'Proposed'. I've tried various expressions
> > in VBA, but so far I've either gotten a 1004 error or a(n) 1101.
> > Here's the relevant snippets of my code:
>
> > Dim Rsrc As Resource
>
> > ' Set Resource Booking Type to Proposed
> > For Each Rsrc In ActiveProject.Resources
> > ActiveProject.Resources(Rsrc).bookingtype =
> > pjBookingTypeProposed
> > MsgBox (Rsrc.Name)
> > Next Rsrc
>
> > You'll notice that it doesn't want to capitalize the "bookingtype"
> > portion, even though it recognizes it and prompts me for the
> > pjBookingTypeProposed. I tried using the SetField method, but those
> > only gave me 1101 errors. this one gives me the run-time error 1004
> > "an unexpected error occurred with the method."
>
> > Based on other threads here, I couldn't figure out why this code did
> > not work. Any thoughts?
>
> > Other threads on topic:
> >http://groups.google.com/group/microsoft.public.project.developer/bro...
> >http://groups.google.com/group/microsoft.public.project.developer/bro...
>
> > Thank you!
--
Rod Gill
Project MVP
Project VBA Book, for details visit:
http://www.projectvbabook.com
NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
----------------------------------------------------------------------------------------------------
"Sean" <sean0m...@gmail.com> wrote in message
news:1189804559.9...@57g2000hsv.googlegroups.com...
--Sean
On Sep 14, 8:02 pm, "Rod Gill" <rod AT project-systems DOT co DOT nz>
wrote:
> So what error do you get running my code. Your original code can't work
> because of the use of a resource object. Also, what version of Project
> Server do you use?
>
> --
>
> Rod Gill
> Project MVP
>
> Project VBA Book, for details visit:
> http://www.projectvbabook.com
>
> NEW!! Web based VBA training course delivered by me. For details visit:
> http://projectservertraining.com/learning/index.aspx
>
> ----------------------------------------------------------------------------------------------------
>
--
Rod Gill
Project MVP
Project VBA Book, for details visit:
http://www.projectvbabook.com
NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
----------------------------------------------------------------------------------------------------
"Sean" <sean0m...@gmail.com> wrote in message
news:1189912462.5...@k79g2000hse.googlegroups.com...
Again, thanks for the help and direction
--Sean
On Sep 16, 8:54 pm, "Rod Gill" <rod AT project-systems DOT co DOT nz>
wrote:
> That may be another cause of your problems. Unless you have the Enterprise
> Resource Pool open, you cannot change and save Enterprise Resource details.
>
> --
>
> Rod Gill
> Project MVP
>
> Project VBA Book, for details visit:
> http://www.projectvbabook.com
>
> NEW!! Web based VBA training course delivered by me. For details visit:
> http://projectservertraining.com/learning/index.aspx
>
> ----------------------------------------------------------------------------------------------------
>
--
Rod Gill
Project MVP
Project VBA Book, for details visit:
http://www.projectvbabook.com
NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
----------------------------------------------------------------------------------------------------
"Sean" <sean0m...@gmail.com> wrote in message
news:1190043200....@g4g2000hsf.googlegroups.com...
Other similar methods are EnterpriseResourceGet, which just adds a
resource to your resource pool, and EnterpriseResourcesImport. Neither
of those look promising. I played a little with the
EnterpriseResourceGet, but no luck there.
There is the option of simply opening the Build Team from Enterprise
dialog with the EnterpriseTeamBuilder method. I'll see if I have any
success with that.
Again, thanks for the help. I'll be sure to post any functional code I
end up with.
--Sean
On Sep 17, 2:05 pm, "Rod Gill" <rod AT project-systems DOT co DOT nz>
wrote:
> Try recording a macro of you opening the resource pool manually.
>
> --
>
> Rod Gill
> Project MVP
>
> Project VBA Book, for details visit:
> http://www.projectvbabook.com
>
> NEW!! Web based VBA training course delivered by me. For details visit:
> http://projectservertraining.com/learning/index.aspx
>
> ----------------------------------------------------------------------------------------------------
>
Dim Rsrc As Resource
Dim RowCount As Integer
'Open Resource Pool to edit Booking Types
Application.ViewApply ("Resource Sheet")
Application.TableApply ("Entry")
Application.TableEdit Name:="Entry", TaskTable:=False,
NewFieldName:="BookingType", _
Title:="BookingType", ColumnPosition:=-1,
OverwriteExisting:=True
Application.TableApply ("Entry")
'Set Counter Variable
RowCount = 1
'Set Resource Booking Type to Proposed
For Each Rsrc In ActiveProject.Resources
If Not (Rsrc Is Nothing) Then 'test for blank resource
SelectResourceField Row:=RowCount, Column:="BookingType",
RowRelative:=False
SetResourceField Field:="BookingType", Value:="Proposed"
End If
RowCount = RowCount + 1
Next Rsrc
If ActiveProject.Resources.Count = RowCount - 1 Then
MsgBox ("All Resources Changed")
Else
MsgBox ("Please change resource bookings to 'Proposed'. ")
EnterpriseTeamBuilder
End If
'Hides the booking type column
SelectResourceColumn Column:="Booking Type"
ColumnDelete
When I get the whole thing polished, I'll post the 'Close Out Project'
macro code here. This was the hardest part though.
--Sean