Opening a webpage from a toolbar button

N

NZ VBA Developer

I imagine this is probably a one-liner: Is there a way to open a webpage by
clicking on a toolbar button? I suspect it's something to do with 'shell' but
my brain is mush and I don't even know where to start...
 
T

Tony Jollans

Create your toolbar button something like this:

Set HyperButton = CommandBars("Menu Bar").Controls.Add(ID:=1576)
HyperButton.HyperlinkType = msoCommandBarButtonHyperlinkOpen
HyperButton.TooltipText = "http://whatever/your/url/is"
 
N

NZ VBA Developer

Thanks Tony. I'll have a bang this arvo - after my brain has re-solidified. ;)
 
A

avkokin

Create your toolbar button something like this:

Set HyperButton = CommandBars("Menu Bar").Controls.Add(ID:=1576)
HyperButton.HyperlinkType = msoCommandBarButtonHyperlinkOpen
HyperButton.TooltipText = "http://whatever/your/url/is"

Hello Tony!
Please help me about for a piece of code - ".Add(ID:=1576)". What mean
is 1576?
Thank you!
 
T

Tony Jollans

1536 id the ID of the hyperlink toolbar button. It just means that's the
type of button you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top