+ Reply to Thread
Results 1 to 5 of 5

Automate Add-in

  1. #1
    Gary's Student
    Guest

    Automate Add-in

    I distribute some workbooks that rely on the Analysis ToolPak. The
    recipients have a problem if the ToolPak is not installed. Upon opening the
    workbook, how can I :

    1. Determine and remember if the ToolPak is already installed
    2. Install the ToolPak if not already installed
    3. Prior to closing the workbook, returning the ToolPak installation status
    to what it was initially
    --
    Gary's Student

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening Gary's Student

    This should work Ok - basically a pair of macros that open run on opening and closing to start the add in and uninstall it if it was uninstalled to begin with. Usual bug bear applies in that the user must reply yes to macros being run.

    Dim status

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If status = "No" Then
    AddIns("Analysis ToolPak").Installed = False
    End If
    End Sub

    Private Sub Workbook_Open()
    If AddIns("Analysis ToolPak").Installed = True Then
    status = "Yes"
    Else
    status = "No"
    End If
    On Error Resume Next
    AddIns("Analysis ToolPak").Installed = True
    End Sub

    just copy this into the ThisWorkbook pane to utilise it.

    HTH

    DominicB

  3. #3
    Jim Cone
    Guest

    Re: Automate Add-in

    GS,

    The following added to the "ThisWorkbook" module seems to work.
    Note that if the module level variable value is lost then the
    ToolPak will be left installed on Excel.
    '---------------------------------------
    Option Explicit

    Private byteFlag As Byte

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If byteFlag < 100 Then
    Excel.AddIns("Analysis ToolPak").Installed = True
    Else
    Excel.AddIns("Analysis ToolPak").Installed = False
    End If
    End Sub

    Private Sub Workbook_Open()
    If Excel.AddIns("Analysis ToolPak").Installed Then
    byteFlag = 99
    Else
    byteFlag = 123
    Excel.AddIns("Analysis ToolPak").Installed = True
    End If

    End Sub
    '-------------------------------------

    Regards,
    Jim Cone
    San Francisco, USA


    "Gary's Student" <[email protected]> wrote in message
    news:[email protected]...
    I distribute some workbooks that rely on the Analysis ToolPak. The
    recipients have a problem if the ToolPak is not installed. Upon opening the
    workbook, how can I :

    1. Determine and remember if the ToolPak is already installed
    2. Install the ToolPak if not already installed
    3. Prior to closing the workbook, returning the ToolPak installation status
    to what it was initially
    --
    Gary's Student

  4. #4
    Gary's Student
    Guest

    Re: Automate Add-in

    Thanks Jim, for both this solution and the others you have helped me with in
    the past.
    --
    Gary's Student


    "Jim Cone" wrote:

    > GS,
    >
    > The following added to the "ThisWorkbook" module seems to work.
    > Note that if the module level variable value is lost then the
    > ToolPak will be left installed on Excel.
    > '---------------------------------------
    > Option Explicit
    >
    > Private byteFlag As Byte
    >
    > Private Sub Workbook_BeforeClose(Cancel As Boolean)
    > If byteFlag < 100 Then
    > Excel.AddIns("Analysis ToolPak").Installed = True
    > Else
    > Excel.AddIns("Analysis ToolPak").Installed = False
    > End If
    > End Sub
    >
    > Private Sub Workbook_Open()
    > If Excel.AddIns("Analysis ToolPak").Installed Then
    > byteFlag = 99
    > Else
    > byteFlag = 123
    > Excel.AddIns("Analysis ToolPak").Installed = True
    > End If
    >
    > End Sub
    > '-------------------------------------
    >
    > Regards,
    > Jim Cone
    > San Francisco, USA
    >
    >
    > "Gary's Student" <[email protected]> wrote in message
    > news:[email protected]...
    > I distribute some workbooks that rely on the Analysis ToolPak. The
    > recipients have a problem if the ToolPak is not installed. Upon opening the
    > workbook, how can I :
    >
    > 1. Determine and remember if the ToolPak is already installed
    > 2. Install the ToolPak if not already installed
    > 3. Prior to closing the workbook, returning the ToolPak installation status
    > to what it was initially
    > --
    > Gary's Student
    >


  5. #5
    Biff
    Guest

    Re: Automate Add-in

    What happens if the end user doesn't have the ATP files on their machine?

    Biff

    "Gary's Student" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks Jim, for both this solution and the others you have helped me with
    > in
    > the past.
    > --
    > Gary's Student
    >
    >
    > "Jim Cone" wrote:
    >
    >> GS,
    >>
    >> The following added to the "ThisWorkbook" module seems to work.
    >> Note that if the module level variable value is lost then the
    >> ToolPak will be left installed on Excel.
    >> '---------------------------------------
    >> Option Explicit
    >>
    >> Private byteFlag As Byte
    >>
    >> Private Sub Workbook_BeforeClose(Cancel As Boolean)
    >> If byteFlag < 100 Then
    >> Excel.AddIns("Analysis ToolPak").Installed = True
    >> Else
    >> Excel.AddIns("Analysis ToolPak").Installed = False
    >> End If
    >> End Sub
    >>
    >> Private Sub Workbook_Open()
    >> If Excel.AddIns("Analysis ToolPak").Installed Then
    >> byteFlag = 99
    >> Else
    >> byteFlag = 123
    >> Excel.AddIns("Analysis ToolPak").Installed = True
    >> End If
    >>
    >> End Sub
    >> '-------------------------------------
    >>
    >> Regards,
    >> Jim Cone
    >> San Francisco, USA
    >>
    >>
    >> "Gary's Student" <[email protected]> wrote in
    >> message
    >> news:[email protected]...
    >> I distribute some workbooks that rely on the Analysis ToolPak. The
    >> recipients have a problem if the ToolPak is not installed. Upon opening
    >> the
    >> workbook, how can I :
    >>
    >> 1. Determine and remember if the ToolPak is already installed
    >> 2. Install the ToolPak if not already installed
    >> 3. Prior to closing the workbook, returning the ToolPak installation
    >> status
    >> to what it was initially
    >> --
    >> Gary's Student
    >>




+ 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