+ Reply to Thread
Results 1 to 5 of 5

installing an addin

  1. #1
    Registered User
    Join Date
    01-14-2006
    Posts
    9

    installing an addin

    I am trying a very simple code for adding a control, named Markov, in Tools and linking it to a macro when the addin is installed.

    Private Sub Workbook_AddinInstall()
    With Application.CommandBars("Tools").Controls.Add
    .Caption = "Markov"
    .OnAction = "markov"
    End With
    End Sub

    The big problem is that after installation nothing happens.
    If I go in VB Editor and click Run the control Markov is added and every thing is going well then. I have tried many other examples but is all the same. The addin appears in the addins manager and it works fine if I fire the run button but not at the installation event.

    Thanks a lot!

  2. #2
    Bob Phillips
    Guest

    Re: installing an addin

    If that control is not within the addin itself, I think you need to link the
    control to a macro in the same workbook, and have that macro use
    Application.Run to call the addin macro.

    Private Sub Workbook_AddinInstall()
    With Application.CommandBars("Tools").Controls.Add
    Caption = "Markov"
    OnAction = "call_markov"
    End With
    End Sub

    and then in a standrad code module

    Public Sub call_markov()
    Application.Run "myAddin.xla!markov"
    End Sub

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "drumerboy" <drumerboy.243851_1141379102.6847@excelforum-nospam.com> wrote
    in message news:drumerboy.243851_1141379102.6847@excelforum-nospam.com...
    >
    > I am trying a very simple code for adding a control, named Markov, in
    > Tools and linking it to a macro when the addin is installed.
    >
    > Private Sub Workbook_AddinInstall()
    > With Application.CommandBars("Tools").Controls.Add
    > Caption = "Markov"
    > OnAction = "markov"
    > End With
    > End Sub
    >
    > The big problem is that after installation nothing happens.
    > If I go in VB Editor and click Run the control Markov is added and
    > every thing is going well then. I have tried many other examples but is
    > all the same. The addin appears in the addins manager and it works fine
    > if I fire the run button but not at the installation event.
    >
    > Thanks a lot!
    >
    >
    > --
    > drumerboy
    > ------------------------------------------------------------------------
    > drumerboy's Profile:

    http://www.excelforum.com/member.php...o&userid=30468
    > View this thread: http://www.excelforum.com/showthread...hreadid=518615
    >




  3. #3
    Registered User
    Join Date
    01-14-2006
    Posts
    9
    Thank you very much Bob!
    I have succeded to do it. The answer was simpler then we have thought:
    "The Private Sub Workbook_AddinInstall() ....End sub" has to be written after a double click on ThisWorkbook in VB Editor and not in a normal module. It was simle but I didn't know this.
    Thank you anyway, you were the onlyone who tryed to help me at this point.

  4. #4
    Bob Phillips
    Guest

    Re: installing an addin

    Oh, didn't realise you had put it there. I would have told you if I had
    realised <bg>.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "drumerboy" <drumerboy.245zfy_1141507801.8551@excelforum-nospam.com> wrote
    in message news:drumerboy.245zfy_1141507801.8551@excelforum-nospam.com...
    >
    > Thank you very much Bob!
    > I have succeded to do it. The answer was simpler then we have thought:
    > "The Private Sub Workbook_AddinInstall() ....End sub" has to be
    > written *after a double click on ThisWorkbook in VB Editor and not in a
    > normal module*. It was simle but I didn't know this.
    > Thank you anyway, you were the onlyone who tryed to help me at this
    > point.
    >
    >
    > --
    > drumerboy
    > ------------------------------------------------------------------------
    > drumerboy's Profile:

    http://www.excelforum.com/member.php...o&userid=30468
    > View this thread: http://www.excelforum.com/showthread...hreadid=518615
    >




  5. #5
    basilio
    Guest

    Re: installing an addin

    sorry to interfere. I have the same problem but I did not understand much of
    your discussion on how to activate an addin. in fact I have saved a workbook
    woth some macros in as an AddIn, but I don't know the way to activate them.
    Can you help me ??
    --
    Basilio


    "Bob Phillips" wrote:

    > If that control is not within the addin itself, I think you need to link the
    > control to a macro in the same workbook, and have that macro use
    > Application.Run to call the addin macro.
    >
    > Private Sub Workbook_AddinInstall()
    > With Application.CommandBars("Tools").Controls.Add
    > Caption = "Markov"
    > OnAction = "call_markov"
    > End With
    > End Sub
    >
    > and then in a standrad code module
    >
    > Public Sub call_markov()
    > Application.Run "myAddin.xla!markov"
    > End Sub
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "drumerboy" <drumerboy.243851_1141379102.6847@excelforum-nospam.com> wrote
    > in message news:drumerboy.243851_1141379102.6847@excelforum-nospam.com...
    > >
    > > I am trying a very simple code for adding a control, named Markov, in
    > > Tools and linking it to a macro when the addin is installed.
    > >
    > > Private Sub Workbook_AddinInstall()
    > > With Application.CommandBars("Tools").Controls.Add
    > > Caption = "Markov"
    > > OnAction = "markov"
    > > End With
    > > End Sub
    > >
    > > The big problem is that after installation nothing happens.
    > > If I go in VB Editor and click Run the control Markov is added and
    > > every thing is going well then. I have tried many other examples but is
    > > all the same. The addin appears in the addins manager and it works fine
    > > if I fire the run button but not at the installation event.
    > >
    > > Thanks a lot!
    > >
    > >
    > > --
    > > drumerboy
    > > ------------------------------------------------------------------------
    > > drumerboy's Profile:

    > http://www.excelforum.com/member.php...o&userid=30468
    > > View this thread: http://www.excelforum.com/showthread...hreadid=518615
    > >

    >
    >
    >


+ 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