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
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