Help with ShowOpen() by CajunCenturion
Help with ShowOpen() by CajunCenturion
(OP)
I searched the archives and found function ShowOpen() and function ShowSave() by CajunCenturion in thread766-100581 (Aug 2004). Both work great with a slight modification;
must readon my system.
How do I extract the filename from ShowOpen() without the entire path included in the string? I will post the code if required.
CODE
.tLng_hWndOwner = Me.hWnd
.tLng_hInstance = App.hInstance
.tLng_hInstance = App.hInstance
CODE
.tLng_hWndOwner = Application.hWnd
.tLng_hInstance = Application.hInstance
.tLng_hInstance = Application.hInstance
How do I extract the filename from ShowOpen() without the entire path included in the string? I will post the code if required.





RE: Help with ShowOpen() by CajunCenturion
Function ReverseString(inString As String) As String
Dim lngLen As Long
lngLen = Len(inString)
If lngLen <= 1 Then
ReverseString = inString
Else
ReverseString = Right(inString, 1) _
& ReverseString(Left(inString, lngLen - 1))
End If
End Function
ie. rPN =ReverseString(PN)
now search for the first instance of "\" character using the built in function InStr, ie
iPos= InStr(1,rPN,"\")
Finally return the filename using Right function
FN=Right(PN,iPos-1)
RE: Help with ShowOpen() by CajunCenturion
RE: Help with ShowOpen() by CajunCenturion
h
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
Steam Engine enthusiasts: www.essexsteam.co.uk
RE: Help with ShowOpen() by CajunCenturion
johnwm, less code but it doesn't work as well. The filename returned always included the folder "Foldername\filename.dxf". I tried to change the compare options of the function but no luck.
The next phase is to predetermine the path and filename which is used to save the file with the showsave() function.
I will need to change the extension of the filename as well.
Any help is appreciated.
RE: Help with ShowOpen() by CajunCenturion
CODE
myFilename = Mid$(fn, InStrRev(fn, "\") + 1)
End Function
Use as
CODE
Debug.Print myFilename(f)
To change the file name use the MID$ command
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
Steam Engine enthusiasts: www.essexsteam.co.uk