By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 739 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Coding to Open myBrowser and insert a Hyperlink

AllusiveKitten
P: 43
Hi

I was wondering if it was possible to code in a command to open the browser which will select a file that I want to insert as a hyperlink using a form.

I hope this does not sound too confusing.

Thank you
AK
Oct 10 '07 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Firstly you will have to make sure there is a reference ticked to the Microsoft Office library and I think this only works properly in Office XP (2002) and above.

Now add the following code to your command button. You don't specify the type of file so I'm going with Excel.

Expand|Select|Wrap|Line Numbers
  1. Dim dlgPickFiles As FileDialog
  2. Dim strFilePath As String
  3.  
  4.     Set dlgPickFiles = Application.FileDialog(msoFileDialogFilePicker)
  5.  
  6.     With dlgPickFiles
  7.         .AllowMultiSelect = False
  8.         .Filters.Clear
  9.         .Filters.Add "Excel files", "*.xls"
  10.     End With
  11.  
  12.     If dlgPickFiles.Show Then
  13.         strFilePath = dlgPickFiles.SelectedItems.Item(1)
  14.     End If
  15.  
  16.     Set dlgPickFiles = Nothing
  17.     Me.txtHyperlink = strFilePath ' I don't know the name of the textbox
  18.  
  19. End Sub
  20.  
Oct 11 '07 #2

AllusiveKitten
P: 43
Thank you so much mmccarty,

You have saved me from going nuts, I cannot thank you enough.

Cheers

AK
Oct 11 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Thank you so much mmccarty,

You have saved me from going nuts, I cannot thank you enough.

Cheers

AK
You're welcome.
Oct 11 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.