Code failure setting an active project across a network

Code failure setting an active project across a network

Anonymous
Not applicable
304 Views
1 Reply
Message 1 of 2

Code failure setting an active project across a network

Anonymous
Not applicable

I am trying to write code to set the active project across a network.  In the code below I have hard written the address in to our main server named "Rusk" .  It fails with an error message "The parameter is incorrect".  I have tried this using a mapped drive as well with no luck.  Can you guys take a look at the code and see if there are any issues. 

 

I think it may be a permissions error, I am running Vista 64bit.  Inventor version 12.  If it is a permissions error, are there any sample code snippets out there I can use to set the permissions?

 

Public Sub SetActiveProject()

Dim ProjectID As String 'variable to hold Project ID
Dim ProjectAddress As String 'variable to hold an address path

'Verify the project ID is entered
If UserForm1.TextBox3.Value = "" Then
    MsgBox "You must enter a project ID before proceeding"
    Exit Sub
End If

'Set the path to Rusk based on Project ID to be implimented when I resolve the code failure below
'ProjectID = UserForm1.TextBox3.Value
'ProjectAddress = "//Rusk/Jobs/PS - 2508_Test File.ipj"

'Check to make sure no documents are open
If ThisApplication.Documents.Count > 0 Then
    MsgBox "All documents must be closed before changing the project"
    Exit Sub
End If

'Set a reference to the DesignProjectManager object followed by setting the project to activate
Dim oDesignProjectMgr As DesignProjectManager
Set oDesignProjectMgr = ThisApplication.DesignProjectManager
Dim oProject As DesignProject
Set oProject = oDesignProjectMgr.DesignProjects.ItemByName("//Rusk/Jobs/PS - 2508_Test File.ipj") 'Here is where the code fails.
oProject.Activate
Debug.Print "New active project:" & oDesignProjectMgr.ActiveDesignProject.FullFileName



End Sub

0 Likes
305 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

You should use this line of code where yours fail.

 Set oProject = oDesignProjectMgr.DesignProjects.AddExisting("//Rus​k/Jobs/PS - 2508_Test File.ipj")

 

0 Likes