![]() |
hyperlinks out of a combo box
This is hopfully a simple thing to do. I currently have a list of files as
choices in a combo box. I would like to be able to hyperlink out to the appropriate file when the file is chosen in the combo box. Using the forms combo box is a little awkward, and in my primitive way of doing things, requires helper cells for the index and hyperlink functions. I know next to nothing of VBA, so any help would be appreciated. I would only require an example; hopefully, I will be able to modify whatever code is given me to suit my needs. wazooli |
hyperlinks out of a combo box
Why use a hyperlink. why not just have the event code open the workbook
with the standard Workbooks.Open "C:\MyFile.xls" -- Regards, Tom Ogilvy "Wazooli" wrote in message ... This is hopfully a simple thing to do. I currently have a list of files as choices in a combo box. I would like to be able to hyperlink out to the appropriate file when the file is chosen in the combo box. Using the forms combo box is a little awkward, and in my primitive way of doing things, requires helper cells for the index and hyperlink functions. I know next to nothing of VBA, so any help would be appreciated. I would only require an example; hopefully, I will be able to modify whatever code is given me to suit my needs. wazooli |
hyperlinks out of a combo box
Thanks for the reply, and good question. Straight up answer: I didn't know
I could use Workbooks.Open "C:\MyFile.xls". Like I said, I know nothing about VBA. Thanks for the suggestion. The only other question I have is how do I translate the choice made in the combo box into what you suggested? Wazooli "Tom Ogilvy" wrote: Why use a hyperlink. why not just have the event code open the workbook with the standard Workbooks.Open "C:\MyFile.xls" -- Regards, Tom Ogilvy "Wazooli" wrote in message ... This is hopfully a simple thing to do. I currently have a list of files as choices in a combo box. I would like to be able to hyperlink out to the appropriate file when the file is chosen in the combo box. Using the forms combo box is a little awkward, and in my primitive way of doing things, requires helper cells for the index and hyperlink functions. I know next to nothing of VBA, so any help would be appreciated. I would only require an example; hopefully, I will be able to modify whatever code is given me to suit my needs. wazooli |
hyperlinks out of a combo box
a dropdown box from the forms toolbar
Sub Drpdwn_Click() sname = Application.Caller With Activesheet.DropDowns(sName) sFile = .List(.ListIndex) End With if dir("C:\MyFiles\" & sfile) < "" then workbooks.Open "C:\MyFiles\" & sFile else msgbox "Bad File name" end if End Sub Assign this macro to the dropdown. Assumes the dropdown contains filenames and all file choices are in a single directory. -------------- a combobox from the control toolbox toolbar. Private Sub Combobox1_Click() if dir ("C:\MyFiles\" & Combobox1.Value) < "" then workbooks.Open "C:\Myfiles\" & Combobox1.Value else msgbox "File does not exist" End if End Sub It depends on what is in the combobox. I am assuming it has somthing like MyFile.xls in the dropdown and all files are in the same directory. http://support.microsoft.com/default.aspx?kbid=213749 XL2000: How to Use a UserForm for Entering Data http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm Lesson 11: Creating a Custom Form Excerpted from Microsoft® Excel 97 Visual Basic® Step by Step. http://j-walk.com/ss/excel/tips/tip84.htm http://support.microsoft.com/default...b;en-us;829070 How to use Visual Basic for Applications examples to control UserForms in Microsoft Excel http://support.microsoft.com/?id=168067 File Title: Microsoft(R) Visual Basic(R) for Applications Examples for Controlling UserForms in Microsoft Excel 97 File Name: WE1163.EXE File Size: 161742 bytes File Date: 05/08/97 Keywords: kbfile Description: This Application Note is an introduction to manipulating UserForms in Microsoft Excel 97. It includes examples and Microsoft Visual Basic for Applications macros that show you how to take advantage of the capabilities of UserForms and use each of the ActiveX controls that are available for UserForms Peter Aiken Articles: Part I http://msdn.microsoft.com/library/en...FormsPartI.asp Part II http://msdn.microsoft.com/library/en...ormsPartII.asp "Wazooli" wrote in message ... Thanks for the reply, and good question. Straight up answer: I didn't know I could use Workbooks.Open "C:\MyFile.xls". Like I said, I know nothing about VBA. Thanks for the suggestion. The only other question I have is how do I translate the choice made in the combo box into what you suggested? Wazooli "Tom Ogilvy" wrote: Why use a hyperlink. why not just have the event code open the workbook with the standard Workbooks.Open "C:\MyFile.xls" -- Regards, Tom Ogilvy "Wazooli" wrote in message ... This is hopfully a simple thing to do. I currently have a list of files as choices in a combo box. I would like to be able to hyperlink out to the appropriate file when the file is chosen in the combo box. Using the forms combo box is a little awkward, and in my primitive way of doing things, requires helper cells for the index and hyperlink functions. I know next to nothing of VBA, so any help would be appreciated. I would only require an example; hopefully, I will be able to modify whatever code is given me to suit my needs. wazooli |
hyperlinks out of a combo box
Wow. Thanks so much for the quick fix (hopefully), as well as the online
resources. Wazooli "Tom Ogilvy" wrote: a dropdown box from the forms toolbar Sub Drpdwn_Click() sname = Application.Caller With Activesheet.DropDowns(sName) sFile = .List(.ListIndex) End With if dir("C:\MyFiles\" & sfile) < "" then workbooks.Open "C:\MyFiles\" & sFile else msgbox "Bad File name" end if End Sub Assign this macro to the dropdown. Assumes the dropdown contains filenames and all file choices are in a single directory. -------------- a combobox from the control toolbox toolbar. Private Sub Combobox1_Click() if dir ("C:\MyFiles\" & Combobox1.Value) < "" then workbooks.Open "C:\Myfiles\" & Combobox1.Value else msgbox "File does not exist" End if End Sub It depends on what is in the combobox. I am assuming it has somthing like MyFile.xls in the dropdown and all files are in the same directory. http://support.microsoft.com/default.aspx?kbid=213749 XL2000: How to Use a UserForm for Entering Data http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm Lesson 11: Creating a Custom Form Excerpted from Microsoft® Excel 97 Visual Basic® Step by Step. http://j-walk.com/ss/excel/tips/tip84.htm http://support.microsoft.com/default...b;en-us;829070 How to use Visual Basic for Applications examples to control UserForms in Microsoft Excel http://support.microsoft.com/?id=168067 File Title: Microsoft(R) Visual Basic(R) for Applications Examples for Controlling UserForms in Microsoft Excel 97 File Name: WE1163.EXE File Size: 161742 bytes File Date: 05/08/97 Keywords: kbfile Description: This Application Note is an introduction to manipulating UserForms in Microsoft Excel 97. It includes examples and Microsoft Visual Basic for Applications macros that show you how to take advantage of the capabilities of UserForms and use each of the ActiveX controls that are available for UserForms Peter Aiken Articles: Part I http://msdn.microsoft.com/library/en...FormsPartI.asp Part II http://msdn.microsoft.com/library/en...ormsPartII.asp "Wazooli" wrote in message ... Thanks for the reply, and good question. Straight up answer: I didn't know I could use Workbooks.Open "C:\MyFile.xls". Like I said, I know nothing about VBA. Thanks for the suggestion. The only other question I have is how do I translate the choice made in the combo box into what you suggested? Wazooli "Tom Ogilvy" wrote: Why use a hyperlink. why not just have the event code open the workbook with the standard Workbooks.Open "C:\MyFile.xls" -- Regards, Tom Ogilvy "Wazooli" wrote in message ... This is hopfully a simple thing to do. I currently have a list of files as choices in a combo box. I would like to be able to hyperlink out to the appropriate file when the file is chosen in the combo box. Using the forms combo box is a little awkward, and in my primitive way of doing things, requires helper cells for the index and hyperlink functions. I know next to nothing of VBA, so any help would be appreciated. I would only require an example; hopefully, I will be able to modify whatever code is given me to suit my needs. wazooli |
hyperlinks out of a combo box
and, P.S. - the second snippet of code works fantastically. thanks again.
wazooli "Tom Ogilvy" wrote: a dropdown box from the forms toolbar Sub Drpdwn_Click() sname = Application.Caller With Activesheet.DropDowns(sName) sFile = .List(.ListIndex) End With if dir("C:\MyFiles\" & sfile) < "" then workbooks.Open "C:\MyFiles\" & sFile else msgbox "Bad File name" end if End Sub Assign this macro to the dropdown. Assumes the dropdown contains filenames and all file choices are in a single directory. -------------- a combobox from the control toolbox toolbar. Private Sub Combobox1_Click() if dir ("C:\MyFiles\" & Combobox1.Value) < "" then workbooks.Open "C:\Myfiles\" & Combobox1.Value else msgbox "File does not exist" End if End Sub It depends on what is in the combobox. I am assuming it has somthing like MyFile.xls in the dropdown and all files are in the same directory. http://support.microsoft.com/default.aspx?kbid=213749 XL2000: How to Use a UserForm for Entering Data http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm Lesson 11: Creating a Custom Form Excerpted from Microsoft® Excel 97 Visual Basic® Step by Step. http://j-walk.com/ss/excel/tips/tip84.htm http://support.microsoft.com/default...b;en-us;829070 How to use Visual Basic for Applications examples to control UserForms in Microsoft Excel http://support.microsoft.com/?id=168067 File Title: Microsoft(R) Visual Basic(R) for Applications Examples for Controlling UserForms in Microsoft Excel 97 File Name: WE1163.EXE File Size: 161742 bytes File Date: 05/08/97 Keywords: kbfile Description: This Application Note is an introduction to manipulating UserForms in Microsoft Excel 97. It includes examples and Microsoft Visual Basic for Applications macros that show you how to take advantage of the capabilities of UserForms and use each of the ActiveX controls that are available for UserForms Peter Aiken Articles: Part I http://msdn.microsoft.com/library/en...FormsPartI.asp Part II http://msdn.microsoft.com/library/en...ormsPartII.asp "Wazooli" wrote in message ... Thanks for the reply, and good question. Straight up answer: I didn't know I could use Workbooks.Open "C:\MyFile.xls". Like I said, I know nothing about VBA. Thanks for the suggestion. The only other question I have is how do I translate the choice made in the combo box into what you suggested? Wazooli "Tom Ogilvy" wrote: Why use a hyperlink. why not just have the event code open the workbook with the standard Workbooks.Open "C:\MyFile.xls" -- Regards, Tom Ogilvy "Wazooli" wrote in message ... This is hopfully a simple thing to do. I currently have a list of files as choices in a combo box. I would like to be able to hyperlink out to the appropriate file when the file is chosen in the combo box. Using the forms combo box is a little awkward, and in my primitive way of doing things, requires helper cells for the index and hyperlink functions. I know next to nothing of VBA, so any help would be appreciated. I would only require an example; hopefully, I will be able to modify whatever code is given me to suit my needs. wazooli |
All times are GMT +1. The time now is 01:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com