Quote:
Originally Posted by syl3786
Thank you so much for your help! You are genius! I ran it but the system informed "BrowseForFile" has not defined. Then I added a function for the "BrowseForFile". It successfully add the hyperlinks to the texts.
[/CODE]
Private Function BrowseForFile(Optional strTitle As String, Optional bExcel As Boolean) As String
Dim fDialog As FileDialog
On Error GoTo err_Handler
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.Title = strTitle
.AllowMultiSelect = False
.Filters.Clear
If bExcel Then
.Filters.Add "Excel workbooks", "*.xls,*.xlsx,*.xlsm"
Else
.Filters.Add "Word documents", "*.doc,*.docx,*.docm"
End If
.InitialView = msoFileDialogViewList
If .Show <> -1 Then GoTo err_Handler:
BrowseForFile = fDialog.SelectedItems.Item(1)
End With
lbl_Exit:
Exit Function
err_Handler:
BrowseForFile = vbNullString
Resume lbl_Exit
End Function
[/CODE]
|
I put "On Error Resume Next" before the "Dim Arr() As Variant". Then Error 94 doesn't pop out.