Running Project From Access

P

Phred Bear

Can somebody point me in the right direction? I'm trying to create a
project, in MSP 98, from Access 2k and I am having difficulty with the
documentation, or lack of. I've looked at everything I can find on the web
but much of it is conflicting.

Here is my code, with which I have tried several variations on the syntax,
but it keeps throwing an error "Object doesn't support this property or
method"

If someone can give me the first few lines which work to start me off, I can
figure it out from there.




Sub CreateNewProjectFile()
On Error GoTo Err_CreateNewProjectFile

Dim pj As Object
Dim PathStr, fName As String
Dim fs As Variant

PathStr = getpath(CurrentDb.Name)
fName = PathStr & "Investigation.mpp"

'Delete file if it already exists
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(fName) Then
Kill fName
End If


Set pj = CreateObject("MSProject.Project")
pj.FileNew (False)


pj.Visible = True


'Do some stuff then close file in "Project"

ExitHere:
On Error Resume Next
' Clean up
Set pj = Nothing
Exit Sub

On Error Resume Next
Exit_CreateNewProjectFile:
Exit Sub

Err_CreateNewProjectFile
MsgBox Err.Description

pj.FileSaveAs (fName)

End Sub


Thanks,

Ian Millward
Edinburgh
 
J

Jan De Messemaeker

Hi,

Set pj=createobject(MSProject.Application)
will do much better!

HTH
 
P

Phred Bear

"Jan De Messemaeker" <jandemes at prom hyphen ade dot be> wrote in message
Hi,

<< Set pj=createobject(MSProject.Application)
will do much better!>>


Cracked it.

Oddly enough, all the stuff I could find, even MS, all had it as
CreateObject(MSProject.Project)

Thanks Jan
 

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