The code to open the selected file becomes
Workbooks.open FileName:=cboSelectedFile.List(,1) & cboSelectedFile.List(,0)
(You might have got confused because I had earlier used cboSelectedFile as
the name of the combobox and later used the name ComboBox1. Sorry for that.)
So you put this piece of code whereever you want to open the file. If you
want to open the file when a user clicks on a button then you put this in the
button's click event. Yoou could also put this code in the combobox's click
event. If you do this then everytime a user click and selects an entry from
the Combobox the corresponding file will open. Hence it all depends on the
design of your application.
Alok
"RSHF" wrote:
> Alok,
> I understand the first part of your instructions but, where do I input
> ComboBox1.List(,1) & ComboBox1.List(,0)
>
> Where does that go in relation to this, Workbooks.open
> FileName:=cboSelectedFile, in the button's click event?
>
> As you can tell, I am still an amateuer!!
>
> "Alok" wrote:
>
> > Yes if you want the file locations(paths or folders) to be hidden from the
> > user you can do that by having the next column list them. When setting the
> > ListFillRange of the combo box you will include this column. Set the number
> > of columns property of the combo box to 2 and set the width of the second
> > column to 0 so that it does not show up. (;0 pt)
> > Then you can create the full file name by
> > ComboBox1.List(,1) & ComboBox1.List(,0)
> > this assumes that the path name includes the "\" at the end.
> >
> >
> > "RSHF" wrote:
> >
> > > Ok, I presume the first step I need to take would be to link the real file
> > > version, to the corresponding entry on the drop down box then. In other
> > > words, on my current sheet the drop down box just lists the names of the
> > > files. I have the files listed as an array which only displays their names.
> > > How do I attach their file loccation without having that shown in the drop
> > > down menu, so that users can scroll through the drop down and select the file
> > > they choose and then use the command button to open that file?
> > >
> > >
> > > "Alok" wrote:
> > >
> > > > If the combo box is called cboSelectedFile then
> > > > add the following code in the button's click event
> > > >
> > > > Workbooks.open FileName:=cboSelectedFile
> > > >
> > > >
> > > > "RSHF" wrote:
> > > >
> > > > > I have a combo box on a master sheet that lists an alphabetical menu of files
> > > > > for users to open. How do I attach hyperlinks to these files in the dropdown
> > > > > menu, so that users may scroll through the menu pick the file they want and
> > > > > then press a command button to open up the chosen file from the master sheet.
> > > > > The drop down menu also functions as a link to a seperate database so I may
> > > > > have to combine the code. Any suggestions?
|