Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Force Re-Install of Analysis Toolpak? | Excel Discussion (Misc queries) | |||
Can't install Analysis ToolPak for Office XP | Setting up and Configuration of Excel | |||
Macro to enable the analysis toolpak VBA addin on entering a workbook?? | Excel Programming | |||
Excel Analysis ToolPak - Bug when installed from Code | Excel Programming | |||
Cannot install Excel 2002 Analysis Addin Toolpak | Excel Programming |