#1   Report Post  
Gary's Student
 
Posts: n/a
Default 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   Report Post  
Jim Cone
 
Posts: n/a
Default

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" wrote in message
...
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
  #3   Report Post  
dominicb
 
Posts: n/a
Default


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


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=380388

  #4   Report Post  
Gary's Student
 
Posts: n/a
Default

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" wrote in message
...
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   Report Post  
Biff
 
Posts: n/a
Default

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

Biff

"Gary's Student" wrote in message
...
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" wrote in
message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate Macro Sherry Excel Discussion (Misc queries) 4 May 16th 08 06:18 PM
I would like to know how to automate graph using drop down list Lokesh Charts and Charting in Excel 2 June 17th 05 05:01 PM
Automate cut/paste functions - Help! Greg Excel Discussion (Misc queries) 2 June 13th 05 07:08 PM
HELP....Is there a way to automate copy/paste special/transpose - Mel Excel Worksheet Functions 7 March 28th 05 11:17 PM
How can I automate a 16 man wrestling bracket in Excell. Bob Imhof Excel Worksheet Functions 1 January 12th 05 06:43 PM


All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"