Creating Multiple New Tasks

K

Kyle

Can anyone tell me why this code does not work. I've tried so many
methods of automatically adding a couple hundred items from a Word
document as tasks. Any help would be greatly appreciated. Thanks

Kyle

-----------------------------------------------------------
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim strParagraph As String
Dim i As Integer
Dim oTask As Task


Set objWord = CreateObject("word.application")
Set objDoc = GetObject("C:\Documents and
Settings\username\Desktop\11.doc")

For i = 1 To objDoc.Paragraphs.Count
strParagraph = Replace(objDoc.Paragraphs(i).Range.Text,
Chr$(9), " ")
Set oTask = ActiveProject.Tasks.Add
oTask.SetField "Name", strParagraph
Next i


If Not (objWord Is Nothing) Then Set objWord = Nothing
If Not (objDoc Is Nothing) Then Set objDoc = Nothing

End Sub
 
R

Rod Gill

Hi,

Where does the program fail?

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top