Message 1 of 9
Object Variable or With block Variable Not Set - Help
Not applicable
12-11-2008
10:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm using the following code from the Inventor help example to set my project. But I get this error, "Object Variable or With block Variable Not Set." It may be that I'm using .NET, not sure?
Thx,
Jon
Public Sub SetProject()
' Check to make sure a document isn't open.
If ThisApplication.Count > 0 Then
MsgBox("All documents must be closed before changing the project.")
Exit Sub
End If
' Set a reference to the FileLocations object.
Dim oFileLocations As FileLocations
oFileLocations = CType(ThisApplication.FileLocations, FileLocations)
' Show the current workspace.
Debug.Print("Workspace: " & oFileLocations.Workspace)
' Set the project file to use.
' This assumes that "C:\Temp\MyProject.ipt" exists.
oFileLocations.FileLocationsFile = "F:\Global-Edit.ipj"
' Show the workspace after making the project change.
Debug.Print("Workspace: " & oFileLocations.Workspace)
End Sub
Thx,
Jon
Public Sub SetProject()
' Check to make sure a document isn't open.
If ThisApplication.Count > 0 Then
MsgBox("All documents must be closed before changing the project.")
Exit Sub
End If
' Set a reference to the FileLocations object.
Dim oFileLocations As FileLocations
oFileLocations = CType(ThisApplication.FileLocations, FileLocations)
' Show the current workspace.
Debug.Print("Workspace: " & oFileLocations.Workspace)
' Set the project file to use.
' This assumes that "C:\Temp\MyProject.ipt" exists.
oFileLocations.FileLocationsFile = "F:\Global-Edit.ipj"
' Show the workspace after making the project change.
Debug.Print("Workspace: " & oFileLocations.Workspace)
End Sub