- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Need to open files from the project workspace.
But, not doing well. Request help. Thanks.
Imports System.Windows.Forms
Imports System.IO
Sub main()
Dim oInventorApplication As Inventor.Application
oInventorApplication = ThisApplication
Dim FSO As Object 'File system object
Dim oFolder_WS As Object 'File object
Dim oSubFolder_WS As Object 'Sub folder object
Dim oFile_Folder_WS As Object 'Object
Dim oDoc As Document
Dim oPath As Object 'String
Dim oWS_w_Slash As Object 'String
oPath = ThisDoc.Path
'Clipboard.SetText(oPath)
'xx = Clipboard.GetText
oWS_wo_Slash = ThisApplication.FileLocations.Workspace
oWS_w_Slash = oWS_wo_Slash & "\"
MessageBox.Show("WorkSpace: " & oWS_w_Slash, "iLogic")
FSO = CreateObject("Scripting.FileSystemObject")
' oWS_wo_Slash = "D:\Vault Workspace\Libraries_Admin_Materials"
oFolder_WS = FSO.GetFolder(oWS_wo_Slash)
For Each oFile_Folder_WS In oFolder_WS.Files
If Right(oFile_Folder_WS.Name, 3) = "ipt" Or Right(oFile_Folder_WS.Name, 3) = "iam" Then
MessageBox.Show("oSubFolder_WS: " & oFolder_WS.Name _
& vbLf & "oFile_Folder_WS: " & oFile_Folder_WS.Name, "Title")
'open the file invisibly
oDoc_to_Open = ThisApplication.Documents.Open(oFile_Folder_WS, False)
End If
Next oFile_Folder_WS
For Each oSubFolder_WS In oFolder_WS.SubFolders
If oSubFolder_WS.name.contains("_V") Then
'Do nothing
Else
MessageBox.Show("oSubFolder_WS: " & oSubFolder_WS.name, "Title")
For Each oFile_Folder_WS In oSubFolder_WS.Files
Next oFile_Folder_WS
End If
Next
End Sub
Solved! Go to Solution.