SiblingRivalry
New member
- Local time
- Today, 14:26
- Joined
- Dec 4, 2006
- Messages
- 4
Hello.
I am using a "File Browse" module to allow me to browse for files on my computer and an OnClick() Command button event procedure to add the filename to a text box on my form.
I would like to make all of my file links in relative, as opposed to absolute, locations though. All of the files are locating in subdirectories of a folder called "Writing."
Is there a way that I can do a variable length LTrim() or something so that the following examples would appear in the text box of the form?
Before: C:\Documents\Test\Writing\Book1\Book.doc
After: Book1\Book.doc
Before: D:\Writing\Poem1\Poem.doc
After: Poem1\Poem.doc
I am using the following code for my OnClick() command button function:
----------------------------------------------------------------
Private Sub Link_Browse_Click()
On Error GoTo Command35_Err
Dim strFilter As String
Dim lngflags As Long
Dim varFileName As Variant
strFilter = "All Files (*.*)" & vbNullChar & "*.*" _
& vbNullChar & "All Files (*.*)" & vbNullChar & "*.*"
lngflags = tscFNPathMustExist Or tscFNFileMustExist _
Or tscFNHideReadOnly
varFileName = tsGetFileFromUser( _
fOpenFile:=True, _
strFilter:=strFilter, _
rlngflags:=lngflags, _
strDialogTitle:="Please choose a file...")
If IsNull(varFileName) Then
Else
Me![Link] = varFileName
End If
Command35_End:
On Error GoTo 0
Exit Sub
Command35_Err:
Beep
MsgBox Err.Description, , "Error: " & Err.Number _
& " in file"
Resume Command35_End
End Sub
-------------------------------------------------------------------
Thanks!
I am using a "File Browse" module to allow me to browse for files on my computer and an OnClick() Command button event procedure to add the filename to a text box on my form.
I would like to make all of my file links in relative, as opposed to absolute, locations though. All of the files are locating in subdirectories of a folder called "Writing."
Is there a way that I can do a variable length LTrim() or something so that the following examples would appear in the text box of the form?
Before: C:\Documents\Test\Writing\Book1\Book.doc
After: Book1\Book.doc
Before: D:\Writing\Poem1\Poem.doc
After: Poem1\Poem.doc
I am using the following code for my OnClick() command button function:
----------------------------------------------------------------
Private Sub Link_Browse_Click()
On Error GoTo Command35_Err
Dim strFilter As String
Dim lngflags As Long
Dim varFileName As Variant
strFilter = "All Files (*.*)" & vbNullChar & "*.*" _
& vbNullChar & "All Files (*.*)" & vbNullChar & "*.*"
lngflags = tscFNPathMustExist Or tscFNFileMustExist _
Or tscFNHideReadOnly
varFileName = tsGetFileFromUser( _
fOpenFile:=True, _
strFilter:=strFilter, _
rlngflags:=lngflags, _
strDialogTitle:="Please choose a file...")
If IsNull(varFileName) Then
Else
Me![Link] = varFileName
End If
Command35_End:
On Error GoTo 0
Exit Sub
Command35_Err:
Beep
MsgBox Err.Description, , "Error: " & Err.Number _
& " in file"
Resume Command35_End
End Sub
-------------------------------------------------------------------
Thanks!