ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CommandBar ActiveX (https://www.excelbanter.com/excel-programming/321749-commandbar-activex.html)

Rob van Gelder[_4_]

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





All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com