1

I have some code that opens a file, copy/pastes some cells into a merged sheet, closes the file; then loops for all the files in a folder. Something like this:

Set SourceFile = Workbooks.Open(FilePath & FileName)
Set Ltab = SourceFile.Worksheets("Sheet1")

Ltab.Cells.Copy
NewTab.Cells.PasteSpecial xlPasteValuess

SourceFile.Close

Is there a line I can add that will stop Excel from loading add ins every time a file is opened? There are a lot of files and loading the add ins adds a good 5-10 seconds every time.

This didn't really answer my question, as I need a way to do it in VBA.

Thanks

Community
  • 1
  • 1
  • 1
    Wild guess: `Application.EnableEvents = False` – findwindow Apr 19 '16 at 16:32
  • Does [this thread](http://www.ozgrid.com/forum/showthread.php?t=25042) help? Or [this SO](http://stackoverflow.com/questions/7921188/vb6-vba-do-not-allow-com-add-in-to-load) thread? – BruceWayne Apr 19 '16 at 17:55
  • @BruceWayne I saw that first thread but couldn't figure out how to address all of Excel's add ins, other than naming them one by one. I'd like this solution to be dynamic, so I don't have to know which and how many add ins there are. AddIns.Installed didn't work without the _Index_ argument. – partiallyfulltime Apr 19 '16 at 19:00

1 Answers1

0

So if you dont wana to disable all addins without naming them, and Installed = false is correct aproach try to iterate them with for each

Sub runWithoutAddins()

Dim var As AddIn

    For Each var In AddIns
        var.Installed = False

    Next var

End Sub

I dont need to know their name, but this will loop every object in AddIn collection and set their atribute Installed to false. (which if im understanding it well, will disable them)

Luboš Suk
  • 1,526
  • 14
  • 38
  • Thanks, the loop is a good idea for addressing the issue of not knowing the name/number. But I guess I have another issue - which is that I want to prevent the add ins from _being loaded in the first place_, whereas code like this would just disable them after the file has opened. My problem is that loading the add ins adds extra time to the process of opening each file, which can pile up with 100+ files. – partiallyfulltime Apr 20 '16 at 16:45
  • @partiallyfulltime hhh i found this :D so you can try https://support.microsoft.com/en-us/kb/213489 probabyl its MS only option how to disable addins :D – Luboš Suk Apr 20 '16 at 16:47