-
Create MS project file from excel
Hi,
Found the following code that enable to generate MS project file from excel,but I'm the Resource value.
Any help will be appriciated.
10X
See the following code:
Sub test()
Dim pjapp As Object
Dim strValue, strStartDate, strEndDate, Strresource As String
Dim newproj
Set pjapp = CreateObject("MSProject.application")
'this checks to see if a valid object has been created. If not it pops up
'a warning and then quits. Users without Project installed will see this message.
If pjapp Is Nothing Then
MsgBox "Project is not installed"
End
End If
'now that we have an application we make it visible
pjapp.Visible = True
'we add a new project
Set newproj = pjapp.Projects.Add
'Alternative: open existing MSProject file
'pjapp.Application.FileOpen "test_export.mpp"
'we set the title property (you can do whatever you want here.
newproj.Title = "My New Project"
'we make the new project the active project
Set ActiveProject = newproj
'and finally we add a new task to the project
'strValue = "yossi"
' strStartDate = "19/07/09"
' strEndDate = "28/07/09"
For I = 2 To 4
strValue = Worksheets("Sheet1").Range("A" & I)
strStartDate = Worksheets("Sheet1").Range("B" & I)
strEndDate = Worksheets("Sheet1").Range("C" & I)
Strresource = Worksheets("Sheet1").Range("D" & I)
newproj.Tasks.Add (strValue & " " & Strresource)
newproj.Tasks(I - 1).Start = strStartDate
newproj.Tasks(I - 1).Finish = strEndDate
' newproj.resource(I - 1).Name = Strresource (it's not working..)
Next I
' pjapp.FileSave
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules