analysis toolpack is already installed message to stop displaying

jordanburch

Active Member
Joined
Jun 10, 2016
Messages
443
Office Version
  1. 2016
Hi all,

I have the below. It is giving me the pop up of that is already enabled in vba. Basically I want it to enable ad ins if they are disabled. I added the part where it enables them and it seems to work but it gives methat pop up and doesnt continue in the loop. I just want it to enable add ins to run code on the file. Any help is appreciated!

Jordan


Sub LoopThroughFiles()
Dim MyObj As Object
Dim MySource As Object
Dim file As Variant
Dim wbThis As Workbook 'workbook where the data is to be pasted, aka Master file
Dim wbTarget As Workbook 'workbook from where the data is to be copied from, aka Overnights file
Dim LastRow As Long
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Application.DisplayAlerts = False

'set to the current active workbook (the source book, the Master!)
Set wbThis = ActiveWorkbook

Set sht1 = wbThis.Sheets("Cleared")

Folder = "C:\Users\jordan.burch.ctr\Desktop\Cert Statements\"
Fname = Dir(Folder)

While (Fname <> "")

Set wbTarget = Workbooks.Open(FileName:=Folder & Fname)
wbTarget.Activate
Application.DisplayAlerts = False

If AddIns("Analysis ToolPak").Installed = True Then _
MsgBox "Analysis ToolPak is already installed" & vbCrLf & _
"", 48, "Be Advised..."

On Error GoTo ErrorHandler
If Not AddIns("Analysis ToolPak").Installed Then
AddIns("Analysis ToolPak").Installed = True
AddIns("Analysis ToolPak - VBA").Installed = True
End If
Exit Sub
ErrorHandler:
MsgBox "FYI, the Analysis ToolPak is not available on your system," & vbCrLf & _
"some operations in this workbook may function properly.", 48, "Be advised..."
Err.Clear
Dim ws As Worksheet
Dim ClearedSheet As String
ClearedSheet = ""
For Each ws In ActiveWorkbook.Worksheets
If InStr(1, ws.Name, "Clear", vbTextCompare) Then
ClearedSheet = ws.Name
Sheets(ClearedSheet).Activate
With ActiveSheet
If .AutoFilterMode Then
If .FilterMode Then
.ShowAllData
End If
Else
If .FilterMode Then
.ShowAllData
End If
End If
End With


Exit For
End If
Application.DisplayAlerts = False

Next
If ClearedSheet <> "" Then
' Sheets("Cleared - Cleared to").Activate


' With ActiveSheet
' If .AutoFilterMode Then
' If .FilterMode Then
' .ShowAllData
' End If
' Else
' If .FilterMode Then
' .ShowAllData
' End If
' End If
' End With

Range("a2:aw40000").Copy

wbThis.Activate

'Just add this line:
LastRow = sht1.Range("b1").End(xlDown).Row + 1
'And alter this one as follows:
sht1.Range("a" & Range("A" & Rows.Count).End(xlUp).Row + 1).PasteSpecial

Fname = Dir

'close the overnight's file
wbTarget.Close
End If
Wend

Application.DisplayAlerts = True

End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If I understand you correctly you have to remove or comment this:
VBA Code:
If
AddIns("Analysis ToolPak").Installed = True Then _
MsgBox "Analysis ToolPak is already installed" & vbCrLf & _
"", 48, "Be Advised..."
If you totally want to remove popup messages you may also need to remove the MsgBox line in the error handler.
 
Upvote 0
If I understand you correctly you have to remove or comment this:
VBA Code:
If
AddIns("Analysis ToolPak").Installed = True Then _
MsgBox "Analysis ToolPak is already installed" & vbCrLf & _
"", 48, "Be Advised..."
If you totally want to remove popup messages you may also need to remove the MsgBox line in the error handler.
thanks! that got rid of the msgbox, not sure why i didnt see that lol. Worked great thank you SIR!
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top