[python-win32] Error when trying to open a Microsoft Project file
Tim Roberts
timr at probo.com
Wed May 30 20:08:39 CEST 2007
Daryl Spitzer wrote:
> I'm trying to open a Microsoft Project file using the following:
>
>
>>>> from win32com.client import Dispatch
>>>> a=Dispatch("MSProject.Application")
>>>> a.Visible=1
>>>> a.FileOpen("C:\test.mpp")
>>>>
>
> ...but I get this error message.
>
> Traceback (most recent call last):
> File "<interactive input>", line 1, in <module>
> File "<COMObject MSProject.Application>", line 8, in FileOpen
> com_error: (-2147352567, 'Exception occurred.', (1004, 'Microsoft
> Office Project', 'Project cannot open the file.', 'C:\\Program
> Files\\Microsoft Office\\OFFICE11\\VBAPJ.CHM', 131072, 0), None)
>
> Project (Standard 2003 SP1) will open C:\test.mpp just fine interactively.
>
> Can anyone tell me why I'm getting this error message?
Yes, I can. You are trying to open a file name with a tab character in
it. That is, your file name is C colon tab E S T dot M P P.
Use
a.FileOpen( "C:\\test.mpp" )
or
a.FileOpen( "C:/test.mpp" )
> What is that
> 'C:\\Program Files\\Microsoft Office\\OFFICE11\\VBAPJ.CHM' file? It
> doesn't exist in that location, but I found it in C:\Program
> Files\Microsoft Office\OFFICE11\1033\. I tried copying it to
> C:\Program Files\Microsoft Office\OFFICE11\ but I get the same error.
>
That's the online help. Project is just telling you where you could
look for more information about the error message.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list