open active doc folder

open active doc folder

k14348
Advocate Advocate
797 Views
7 Replies
Message 1 of 8

open active doc folder

k14348
Advocate
Advocate

Hi,

    I would like to open the inventor active doc folder through vba or ilogic. Can somebody help on this. folder should open in file explorer not within inventor.

 

Sample

Sub Openpath()

Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument

Dim oPath As String
oPath = oDoc.FullFileName


Call Shell("explorer.exe" & " " & "oPath", vbNormalFocus)
End Sub

 

Thank u,

K14348

0 Likes
Accepted solutions (1)
798 Views
7 Replies
Replies (7)
Message 2 of 8

j.brodersen
Enthusiast
Enthusiast

Hi k14348,

I found the code below which opens the win explorer with the path of the part it has been lunched from

Sub Main

Shell ("explorer.exe " & ThisDoc.Path, vbNormalFocus) 

End Sub

Hope it's what you are looking for.

0 Likes
Message 3 of 8

dean.morrison
Advocate
Advocate
Accepted solution

Hi,

 

This will open your workspace folder.

Hope it helps.

 

Dim oFileLocations As FileLocations

Set oFileLocations = ThisApplication.FileLocations

oPath = oFileLocations.Workspace

Call Shell("explorer.exe " & oPath, vbNormalFocus)

 

Dean.

0 Likes
Message 4 of 8

k14348
Advocate
Advocate

Hi Dean,

            How u found  FileLocations as its not  default. Its not shown while typing in VBA.

Thanks

Karthikeyan M

0 Likes
Message 5 of 8

dean.morrison
Advocate
Advocate

Unsure how i found it, it was probably on this forum somewhere.

 

Dean.

 

 

0 Likes
Message 6 of 8

Anonymous
Not applicable

Public Sub ExplorerActiveLocation()
Dim oFullfilename As String
oFullfilename = ThisApplication.ActiveDocument.fullFilename
Dim oLocation As String
oLocation = Left(oFullfilename, Len(oFullfilename) - Len(StrReverse(Left(StrReverse(oFullfilename), InStr(1, StrReverse(oFullfilename), "\") - 1))) - 1)
Shell "explorer.exe " & oLocation, vbNormalFocus
End Sub

0 Likes
Message 7 of 8

Anonymous
Not applicable

'Open & Select
Public Sub ExplorerActiveLocation()

Dim oFullfilename As String
oFullfilename = ThisApplication.ActiveDocument.fullFilename
Shell "explorer.exe /select, " & oFullfilename, vbNormalFocus
End Sub

0 Likes
Message 8 of 8

MichaëlStienstra
Participant
Participant

There is some code I personally use. Maybe it's helpful. 

'Code voor het openen van de bestandsfolder met behulp van windows file explorer
Sub Main()
	'aanroep locatie
	oPath = ThisDoc.Path
	'open file explorer (programma)
	Dim Proc As String = "Explorer.exe"
	Dim Args As String = ControlChars.Quote & oPath & ControlChars.Quote
	Process.Start(Proc, Args)
End Sub

 

0 Likes