Try the Split Function.
This code could be optimised better but here is a quick way to grab the filename.
Code:
Private Sub Form_Load()
' Declare Variables
Dim path As String
Dim firstsplit() As String
Dim secondsplit() As String
' Filename
path = "C:\PF\GUI\export\a.sph"
' Split by "\"
firstsplit = Split(path, "\")
' Grab the full filename with extension and Split by "."
secondsplit = Split(firstsplit(4), ".")
'Grab the filename
MsgBox secondsplit(0)
End Sub
Last edited by kevchadders; Feb 8th, 2008 at 04:26 AM.
CommonDialog4.InitDir = App.Path & "\export"
CommonDialog4.Filter = Shape
CommonDialog4.DialogTitle = "Save selected feature"
CommonDialog4.ShowSave
outputfile = CommonDialog4.FileName
intI = InStrRev(outputfile, ".")
If intI > 0 Then
outputfile = Left$(outputfile, intI - 1)
End If
The above searches for a "." in the variable outputfile and then truncates outputfile to the character before the "."