-
Solved: Webbrowser page depending on listbox value
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.h tml
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
-
[VBA]Private Sub CommandButton1_Click()
pth = "c:\cityworksnas002\gismaster\Vector_Data\Shapes\" & Listbox1.Value & ".html"
UserForm2.WebBrowser1.Navigate pth
End Sub[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
That worked a treat, many thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules