|
|
Rank: Member Groups: Member
Joined: 12/29/2010 Posts: 10
|
Hi, is there a way in vba to get the path of the current display without the Filename? With I get the Fullpath but I only need the directory. greets tompkins
|
|
|
|
|
OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System. We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ or contact OSIsoft vCampus for more details.
|
|
|
Rank: Advanced Member
 Groups: Member
Joined: 4/7/2011 Posts: 137 Location: KZN, South Africa
|
Try this and see if it works.
Debug.Print Mid(ThisDisplay.Path, 1, Len(ThisDisplay.Path) - Len(Mid(Mid(Application.Caption, 19), 1, Len(Mid(Application.Caption, 19)) - 2)))
|
|
|
Rank: Member Groups: Member
Joined: 12/29/2010 Posts: 10
|
Almost perfect, but if the display is saved I have no * in its caption. so it must be Code: Mid(ThisDisplay.Path, 1, Len(ThisDisplay.Path) - Len(Mid(Mid(Application.Caption, 19), 1, Len(Mid(Application.Caption, 19)) - 3)))
in this case.
|
|
|
Rank: Advanced Member
 Groups: Member
Joined: 4/7/2011 Posts: 137 Location: KZN, South Africa
|
That is correct, the * indicates that the display has changed if memory servs me right, so you will have to change it as you did.
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 617 Location: Cheshire, United Kingdom.
|
Here is how I have done it... Code: Dim FP As String: FP = UCase(ThisDisplay.Path) Dim vFP As Variant: vFP = Split(FP, "\")
Debug.Print Replace(FP, vFP(UBound(vFP)), "")
Remember, if you haven't save the display before then there is no path. * indicates the display has been modified, you can change that by "ThisDisplay.Modified = False" or by calling the "Save" method. Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
|
Guest
|