PDA

View Full Version : Solved: Webbrowser page depending on listbox value



dicky_1980
08-10-2009, 09:20 AM
Hi,

I'm trying to open a page of HTML in a webbrowser based on based on the value in a listbox.

For example i have a value "Highways" in a listbox and i want to tell the webrowser to open highways.html

i can do this with a series of IF statementents using

UserForm2.WebBrowser1.Navigate c:\cityworksnas002\gismaster\Vector_Data\Shapes\highways.html
but that will take ages

so i wanted something more like
UserForm2.WebBrowser1.Navigate "c:\cityworksnas002\gismaster\Vector_Data\Shapes\UserForm2.Listbox1.Value.ht ml

all of the html files are in the same folder so i just want to insert the listbox value infront of the .html


but i'm not sure how to go about this

Thanks
Michael

mdmackillop
08-11-2009, 01:49 AM
Private Sub CommandButton1_Click()
pth = "c:\cityworksnas002\gismaster\Vector_Data\Shapes\" & Listbox1.Value & ".html"
UserForm2.WebBrowser1.Navigate pth
End Sub

dicky_1980
08-11-2009, 02:14 AM
That worked a treat, many thanks