Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding a file path to a Hyperlink field does not link

Status
Not open for further replies.

barra47

Programmer
Dec 25, 2002
86
AU
I have a control button with the following code
It opens a browse window where you search for the file and then it places the path into the field called filepath ( Hyperlink type field)
but when I click the path in the field it does not link
Please help

Private Sub Command7_Click()
Dim retFiletext As String, dlg As Variant, s As String
Dim strImagePath As String
Dim retFile As Object
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
With dlg
.InitialFileName = CodeProject.path & "\Images"
If .Show = -1 Then s = .SelectedItems(1)
End With
If s <> "" Then
retFiletext = Right(s, Len(s) + InStrRev(s, "\"))
Me.filepath.value = retFiletext
End If
strImagePath = Me.filepath
End Sub

Thanks in Advance
 
How are ya barra47 . . .

Have a look at the HyperlinkPart to see thw syntax for writing to a hyperlink field.

In your code try:
Code:
[blue]   Me.filepath = "#" & retFiletext & "#"[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Also look at bookmarks

.ActiveDocument.Bookmarks("FirstName").Select
.Selection.Text = CStr(Me.FirstName.Value)
.ActiveDocument.Bookmarks.ADD Name = FirstName

I use this to populate bookmarks in word document

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top