Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2010, 09:06 AM
Authorized User
 
Join Date: Aug 2010
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
Default Error:"msoControlPopup is not declared" when i write an addin for Excel

Hello,I just begin to write addins,I don't know much about it.I want to write an addin for Excel,But the error occured.The two Error were red ones.The code was wrote with VB2008
Name "msoControlPopup" is not declared
Name "msoControlButton" is not declared
Code:
Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Core
Imports Microsoft.Office.Core.MsoAlertButtonType

Implements Extensibility.IDTExtensibility2
Dim WithEvents MyButton As CommandBarButton
Private applicationObject As Object 
Private addInInstance As Object

Public Sub OnStartupComplete(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnStartupComplete
      Dim oCommandBars As CommandBars
        Dim oStandardBar As CommandBar
        Dim oBarPopup As CommandBarPopup
        On Error Resume Next
        oCommandBars = applicationObject.CommandBars
        oStandardBar = oCommandBars.Item("Standard")
        oBarPopup = oStandardBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
        oBarPopup.Caption = "COMAddIn"
        MyButton = oBarPopup.Controls.Add(Type:=msoControlButton)
        With MyButton
            .Caption = "Hide and unhide worksheets"
            .Style = MsoButtonStyle.msoButtonCaption
            .Tag = "My Custom Button"
            .OnAction = "!<MyCOMAddin.Connect>"
            .Visible = True
        End With
        oStandardBar = Nothing
        oCommandBars = Nothing
    End Sub
Can anyone tell me what's wrong?

Last edited by Waterharbin; September 23rd, 2010 at 09:17 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Labels etc on ascx page "Not Declared" Wozer BOOK: Professional DotNetNuke Module Programming ISBN: 978-0-470-17116-5 2 January 22nd, 2010 04:28 PM
Need code corrections "get sub or function not defined" error" bluesboytoo Excel VBA 1 October 22nd, 2009 11:12 PM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Export to Excel Error "HRESULT : 0x800AC472" Michael YoeH ASP.NET 3.5 Professionals 0 July 14th, 2009 03:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.