+ Reply to Thread
Results 1 to 4 of 4

Run time error '-2147467259 (80004005) adding icon

  1. #1
    DMc2005
    Guest

    Run time error '-2147467259 (80004005) adding icon

    Hi

    I get the error

    Run time error '-2147467259 (80004005)

    Method 'Add' of object 'commandBarControls' failed.

    why does this happen? basically i am trying to use that button image for a
    to run a macro.

    D

    With .Add(msoControlButton, 749) <---- this line causes the
    error.
    .Style = msoButtonIconAndCaption
    .Caption = "Create Individual Trainer Feedback Workbooks"
    .OnAction = "CreateCourseFeedbackDocuments"
    End With
    With .Add(msoControlButton, 463)
    .Style = msoButtonIconAndCaption
    .Caption = "About"
    .OnAction = "About"
    End With
    End With



  2. #2
    Tom Ogilvy
    Guest

    Re: Run time error '-2147467259 (80004005) adding icon

    Sub EFG()
    With Application.CommandBars( _
    "Menu1")
    With .Controls.Add(msoControlButton)
    .Style = msoButtonIconAndCaption
    .FaceId = 749
    .Caption = "Create Individual Trainer Feedback Workbooks"
    .OnAction = "CreateCourseFeedbackDocuments"
    End With
    With .Controls.Add(msoControlButton)
    .Style = msoButtonIconAndCaption
    .FaceId = 463
    .Caption = "About"
    .OnAction = "About"
    End With
    End With
    End Sub

    Sub CreateCourseFeedbackDocuments()
    MsgBox "In CreateCourseFeedbackDocuments"
    End Sub
    Sub About()
    MsgBox "In About"
    End Sub

    Change Menu1 to your commandbar. If you want it on the main menu, use
    "Worksheet Menu Bar"

    --
    Regards,
    Tom Ogilvy


    "DMc2005" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi
    >
    > I get the error
    >
    > Run time error '-2147467259 (80004005)
    >
    > Method 'Add' of object 'commandBarControls' failed.
    >
    > why does this happen? basically i am trying to use that button image for a
    > to run a macro.
    >
    > D
    >
    > With .Add(msoControlButton, 749) <---- this line causes the
    > error.
    > .Style = msoButtonIconAndCaption
    > .Caption = "Create Individual Trainer Feedback Workbooks"
    > .OnAction = "CreateCourseFeedbackDocuments"
    > End With
    > With .Add(msoControlButton, 463)
    > .Style = msoButtonIconAndCaption
    > .Caption = "About"
    > .OnAction = "About"
    > End With
    > End With
    >
    >




  3. #3
    DMc2005
    Guest

    Re: Run time error '-2147467259 (80004005) adding icon

    thanks. why did it generate an error when it was on the same line?

    D
    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > Sub EFG()
    > With Application.CommandBars( _
    > "Menu1")
    > With .Controls.Add(msoControlButton)
    > .Style = msoButtonIconAndCaption
    > .FaceId = 749
    > .Caption = "Create Individual Trainer Feedback Workbooks"
    > .OnAction = "CreateCourseFeedbackDocuments"
    > End With
    > With .Controls.Add(msoControlButton)
    > .Style = msoButtonIconAndCaption
    > .FaceId = 463
    > .Caption = "About"
    > .OnAction = "About"
    > End With
    > End With
    > End Sub
    >
    > Sub CreateCourseFeedbackDocuments()
    > MsgBox "In CreateCourseFeedbackDocuments"
    > End Sub
    > Sub About()
    > MsgBox "In About"
    > End Sub
    >
    > Change Menu1 to your commandbar. If you want it on the main menu, use
    > "Worksheet Menu Bar"
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "DMc2005" <[email protected]> wrote in message
    > news:%[email protected]...
    >> Hi
    >>
    >> I get the error
    >>
    >> Run time error '-2147467259 (80004005)
    >>
    >> Method 'Add' of object 'commandBarControls' failed.
    >>
    >> why does this happen? basically i am trying to use that button image for
    >> a
    >> to run a macro.
    >>
    >> D
    >>
    >> With .Add(msoControlButton, 749) <---- this line causes the
    >> error.
    >> .Style = msoButtonIconAndCaption
    >> .Caption = "Create Individual Trainer Feedback Workbooks"
    >> .OnAction = "CreateCourseFeedbackDocuments"
    >> End With
    >> With .Add(msoControlButton, 463)
    >> .Style = msoButtonIconAndCaption
    >> .Caption = "About"
    >> .OnAction = "About"
    >> End With
    >> End With
    >>
    >>

    >
    >




  4. #4
    Tom Ogilvy
    Guest

    Re: Run time error '-2147467259 (80004005) adding icon

    On the same line you are talking about a built in commandbar ID: (from help)

    Id Optional Variant. An integer that specifies a built-in control. If the
    value of this argument is 1, or if this argument is omitted, a blank custom
    control of the specified type will be added to the command bar.

    You just wanted to use the ICON which is the FaceID - two different things.

    --
    Regards,
    Tom Ogilvy


    "DMc2005" <[email protected]> wrote in message
    news:[email protected]...
    > thanks. why did it generate an error when it was on the same line?
    >
    > D
    > "Tom Ogilvy" <[email protected]> wrote in message
    > news:[email protected]...
    > > Sub EFG()
    > > With Application.CommandBars( _
    > > "Menu1")
    > > With .Controls.Add(msoControlButton)
    > > .Style = msoButtonIconAndCaption
    > > .FaceId = 749
    > > .Caption = "Create Individual Trainer Feedback Workbooks"
    > > .OnAction = "CreateCourseFeedbackDocuments"
    > > End With
    > > With .Controls.Add(msoControlButton)
    > > .Style = msoButtonIconAndCaption
    > > .FaceId = 463
    > > .Caption = "About"
    > > .OnAction = "About"
    > > End With
    > > End With
    > > End Sub
    > >
    > > Sub CreateCourseFeedbackDocuments()
    > > MsgBox "In CreateCourseFeedbackDocuments"
    > > End Sub
    > > Sub About()
    > > MsgBox "In About"
    > > End Sub
    > >
    > > Change Menu1 to your commandbar. If you want it on the main menu, use
    > > "Worksheet Menu Bar"
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "DMc2005" <[email protected]> wrote in message
    > > news:%[email protected]...
    > >> Hi
    > >>
    > >> I get the error
    > >>
    > >> Run time error '-2147467259 (80004005)
    > >>
    > >> Method 'Add' of object 'commandBarControls' failed.
    > >>
    > >> why does this happen? basically i am trying to use that button image

    for
    > >> a
    > >> to run a macro.
    > >>
    > >> D
    > >>
    > >> With .Add(msoControlButton, 749) <---- this line causes the
    > >> error.
    > >> .Style = msoButtonIconAndCaption
    > >> .Caption = "Create Individual Trainer Feedback

    Workbooks"
    > >> .OnAction = "CreateCourseFeedbackDocuments"
    > >> End With
    > >> With .Add(msoControlButton, 463)
    > >> .Style = msoButtonIconAndCaption
    > >> .Caption = "About"
    > >> .OnAction = "About"
    > >> End With
    > >> End With
    > >>
    > >>

    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1