Error code 1004 generated while trying to open a file using VBA , FileOpen.

R

Rajesh R

Hi
I have written some VBA code, in MSP 2002, to detect if a
certain mpp file is open or not , if it is not open then
open it.

In VBA i am using the FileOpen command


<code>

Sub OpenTemplate()
On Error GoTo l_Errorhandler
Dim l_str_TemplateName As String
Dim l_int_ProjCnt As Integer
Dim l_tmp_TemplateName As String
Dim l_bol_ProjLoaded As Boolean


l_str_TemplateName = GetTemplateName()
If Not (l_bol_ProjLoaded) Then
l_str_TemplateName = l_str_TemplateName & ".mpp"
FileOpen l_str_TemplateName, True, , , , ,
True, "administrator", "0304admin65", "MSProject.mpp.9", ,
pjPoolReadWrite, , , False
FileOpen l_str_TemplateName
End If

l_Exit:
Exit Sub

l_Errorhandler:
Call gs_void_ErrorHandler(Err.Description, Err.Number,
Err.Source)
GoTo l_Exit
End Sub

</code>

l_str_TemplateName is the template name , now to this i
add the server url or even i tried considering the Full
Name!
But Microsoft Project 2002 throws up an error
****
Microsoft Project : 1004 : Microsoft Project cannot open
the file.
****


Please help me resolve this error !

Rgds Rajesh
 

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