# Vba code to open webpage



## ronojinx

Please help me with vba code that enables a participular webpage to open when a particular record is displayed on an ms acess form.This can be on a command button


----------



## draceplace

this will do it..

Set Sh = WScript.CreateObject("WScript.Shell")
Sh.Run "http://forums.techguy.org/software-development/761054-vba-code-open-webpage.html", 3


----------



## draceplace

Oops that probably won't run in access. You should be able to use hyperlink?


----------



## ronojinx

I figured it out
appluication.followhyperlink "C:\Ron\techguy.html"


----------



## ronojinx

but to open a particular webpage via the form, a more complex code is needed...any idea??


----------



## draceplace

put your command button on the form. Go into properties, Event tab, 'On Click' select 'event procedure' click the "..." on the right / make it look like this:

Private Sub Command0_Click()
Application.FollowHyperlink "http://www.google.com/"
End Sub


----------

