YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Path of current display Options · View
tompkins
#1 Posted : Wednesday, July 13, 2011 10:08:27 AM
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
Code:

Me.Path

I get the Fullpath but I only need the directory.

greets
tompkins
Sponsor  
 

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.
squatty
#2 Posted : Wednesday, July 13, 2011 11:10:27 AM
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)))
tompkins
#3 Posted : Wednesday, July 13, 2011 11:20:32 AM
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.
squatty
#4 Posted : Wednesday, July 13, 2011 11:26:08 AM
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.
RJK Solutions
#5 Posted : Wednesday, July 13, 2011 2:06:30 PM
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
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.