Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Code to install Analysis ToolPak at Workbook Open

Hi,

I need to have Analysis Toolpak auto-installed when my workbook is opened --
I tried to modify code that I have to auto-install Solver (which works for
Solver), however, it is not working for Analysis ToolPak. Any idea why this
is not working? FYI - the original code to install Solver was copied from
"Peltier Technical Services" website
(http://peltiertech.com/Excel/SolverVBA.html).

Public Function CheckAntoolpak() As Boolean
'' Adjusted for Application.Run() to avoid Reference problems with
Analysis ToolPak
'' Peltier Technical Services, Inc., Copyright © 2007. All rights reserved.
'' Returns True if Analysis ToolPak can be used, False if not.

Dim bantoolpakInstalled As Boolean

If gbDebug Then Debug.Print Now, "Checkantoolpak "
'' Assume true unless otherwise
CheckAntoolpak = True

On Error Resume Next
' check whether Analysis ToolPak is installed
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
Err.Clear

If bantoolpakInstalled Then
' uninstall temporarily
Application.AddIns("Analysis ToolPak Add-In").Installed = False
' check whether Analysis ToolPak is installed (should be false)
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
End If

If Not bantoolpakInstalled Then
' (re)install Analysis ToolPak
Application.AddIns("Analysis ToolPak Add-In").Installed = True
' check whether Analysis ToolPak is installed (should be true)
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
End If

If Not bantoolpakInstalled Then
MsgBox "Analysis ToolPak not found. This workbook will not work.",
vbCritical
CheckAntoolpak = False
End If

If CheckAntoolpak Then
' initialize Analysis ToolPak
Application.Run "Analysis ToolPak.xla!Analysis ToolPak.Auto_open"
End If

On Error GoTo 0

End Function

--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Code to install Analysis ToolPak at Workbook Open

Hi Robert,

Try changing -

"Analysis ToolPak Add-In"
to
"Analysis ToolPak"

or, if you want the ATP addin for use with VBA
"Analysis ToolPak - VBA"

Regards,
Peter T

"robs3131" wrote in message
...
Hi,

I need to have Analysis Toolpak auto-installed when my workbook is

opened --
I tried to modify code that I have to auto-install Solver (which works for
Solver), however, it is not working for Analysis ToolPak. Any idea why

this
is not working? FYI - the original code to install Solver was copied from
"Peltier Technical Services" website
(http://peltiertech.com/Excel/SolverVBA.html).

Public Function CheckAntoolpak() As Boolean
'' Adjusted for Application.Run() to avoid Reference problems with
Analysis ToolPak
'' Peltier Technical Services, Inc., Copyright © 2007. All rights

reserved.
'' Returns True if Analysis ToolPak can be used, False if not.

Dim bantoolpakInstalled As Boolean

If gbDebug Then Debug.Print Now, "Checkantoolpak "
'' Assume true unless otherwise
CheckAntoolpak = True

On Error Resume Next
' check whether Analysis ToolPak is installed
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
Err.Clear

If bantoolpakInstalled Then
' uninstall temporarily
Application.AddIns("Analysis ToolPak Add-In").Installed = False
' check whether Analysis ToolPak is installed (should be false)
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
End If

If Not bantoolpakInstalled Then
' (re)install Analysis ToolPak
Application.AddIns("Analysis ToolPak Add-In").Installed = True
' check whether Analysis ToolPak is installed (should be true)
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
End If

If Not bantoolpakInstalled Then
MsgBox "Analysis ToolPak not found. This workbook will not work.",
vbCritical
CheckAntoolpak = False
End If

If CheckAntoolpak Then
' initialize Analysis ToolPak
Application.Run "Analysis ToolPak.xla!Analysis ToolPak.Auto_open"
End If

On Error GoTo 0

End Function

--
Robert



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Code to install Analysis ToolPak at Workbook Open

Thanks Peter! That fixed it!

--
Robert


"Peter T" wrote:

Hi Robert,

Try changing -

"Analysis ToolPak Add-In"
to
"Analysis ToolPak"

or, if you want the ATP addin for use with VBA
"Analysis ToolPak - VBA"

Regards,
Peter T

"robs3131" wrote in message
...
Hi,

I need to have Analysis Toolpak auto-installed when my workbook is

opened --
I tried to modify code that I have to auto-install Solver (which works for
Solver), however, it is not working for Analysis ToolPak. Any idea why

this
is not working? FYI - the original code to install Solver was copied from
"Peltier Technical Services" website
(http://peltiertech.com/Excel/SolverVBA.html).

Public Function CheckAntoolpak() As Boolean
'' Adjusted for Application.Run() to avoid Reference problems with
Analysis ToolPak
'' Peltier Technical Services, Inc., Copyright © 2007. All rights

reserved.
'' Returns True if Analysis ToolPak can be used, False if not.

Dim bantoolpakInstalled As Boolean

If gbDebug Then Debug.Print Now, "Checkantoolpak "
'' Assume true unless otherwise
CheckAntoolpak = True

On Error Resume Next
' check whether Analysis ToolPak is installed
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
Err.Clear

If bantoolpakInstalled Then
' uninstall temporarily
Application.AddIns("Analysis ToolPak Add-In").Installed = False
' check whether Analysis ToolPak is installed (should be false)
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
End If

If Not bantoolpakInstalled Then
' (re)install Analysis ToolPak
Application.AddIns("Analysis ToolPak Add-In").Installed = True
' check whether Analysis ToolPak is installed (should be true)
bantoolpakInstalled = Application.AddIns("Analysis ToolPak
Add-In").Installed
End If

If Not bantoolpakInstalled Then
MsgBox "Analysis ToolPak not found. This workbook will not work.",
vbCritical
CheckAntoolpak = False
End If

If CheckAntoolpak Then
' initialize Analysis ToolPak
Application.Run "Analysis ToolPak.xla!Analysis ToolPak.Auto_open"
End If

On Error GoTo 0

End Function

--
Robert




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
How to Force Re-Install of Analysis Toolpak? Will[_3_] Excel Discussion (Misc queries) 2 October 8th 08 09:29 PM
Can't install Analysis ToolPak for Office XP mk Setting up and Configuration of Excel 2 December 31st 06 12:54 AM
Macro to enable the analysis toolpak VBA addin on entering a workbook?? bsnapool[_12_] Excel Programming 2 July 15th 06 11:41 AM
Excel Analysis ToolPak - Bug when installed from Code pc Excel Programming 6 January 9th 06 02:17 PM
Cannot install Excel 2002 Analysis Addin Toolpak robbyn Excel Programming 2 January 30th 04 11:41 PM


All times are GMT +1. The time now is 10:01 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"