Command bar diclaration

  • Thread starter Thread starter areddy
  • Start date Start date
A

areddy

Hi All,

How to declare commandbar in visual basic6.0

in excel visual basic editor iam declaring as

Dim oCB As Commandbar

i declare same as above but it is saying

Compile error:
User-Defined type not defined error is coming.

How we have to declare in visual basic.

Thanks&Regards,
Amar...
 
assuming that you have a reference set to th eexcel objects library

Dim xl As Excel.Application
Dim wb As Excel.Workbook
Dim oCB As Object

Set xl = New Excel.Application
xl.Visible = True
Set oCB = xl.CommandBars.Add("test")
oCB.Visible = True
 
In XL VBE check the established references (Tools | References...)
That should tell you which library your VB code should reference to use
early binding with commandbars.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

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

Similar Threads

Command bar diclaration 2
VBA CODE HELP! 0
RunWhen error 4
Declaring Command Bar Control 4
Toolbars & command disabled 1
Commandbar on thisworkbook only 6
Works too well - Hide toolbar Macro 4
Close help 2

Back
Top