View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default CommandBar ActiveX

Hi Everyone.

I read the other day about the Object Browser and how you can Show Hidden
Members.
So, I thought I'd go exploring - for fun - and discovered CommandBarActiveX
object.

I got it sort of working so you can have a WebBrowser Commandbar Button -
which is promising.
For my own personal productivity Personal.xls, I'd like to build it more.
It gets funky with the Width and Height - making it's own mind up -
especially when docking.

Has anyone has experience in this area and can assist?


Private MyWeb As WebBrowser

Sub test()
Const cBarName = "My Web Browser"
Dim bar As CommandBar, cbt As [_CommandBarActiveX]

On Error Resume Next: Application.CommandBars(cBarName).Delete: On Error
GoTo 0

With Application.CommandBars.Add(cBarName, , , True)
Set cbt = .Controls.Add(msoControlActiveX)
cbt.ControlCLSID = "{8856F961-340A-11D0-A96B-00C04FD705A2}"
'Microsoft Internet Controls
.Visible = True
DoEvents
Set MyWeb =
cbt.QueryControlInterface("{00020400-0000-0000-C000-000000000046}")
'IDispatch
MyWeb.Navigate2 "http://www.google.com/"
End With
End Sub


(Please, no reminders about the nature of undocumented features...)

Cheers

--
Rob van Gelder - http://www.vangelder.co.nz/excel