Iban Arriola
Iban Arriola

Reputation: 2776

exec a xlam everytime I open an excel file

I have the following peace of code to exec a xlam file when I open the excel file:

   Sub Auto_Open()
      Application.OnTime Now + TimeValue("00:00:05"), "readCsv"
   End Sub

   Sub readCsv()
      ....
   End Sub

I add it as Add-ins so every file I open has the xlam file on it. If there is no other excel file opened, it works perfectly but after that without closing the excel file I open a second one it does nothing. I need to exec the code even if there is another excel file opened. Is that possible?

I also try to do it writing the code in ThisWorkbook but the result is the same, If there is another excel file opened it does nothing.

Upvotes: -1

Views: 3833

Answers (2)

mcfroob
mcfroob

Reputation: 1154

Copy the .xlam to C:\Users[user]\AppData\Roaming\Microsoft\Excel\XLSTART. It will load every time you open Excel.

Upvotes: 1

Vasim
Vasim

Reputation: 3143

To use your macro in any of the worksheet opened (irrespective of name) you can only possible do it by using a personal workbook Here is the Link

If the above doesnt suits you can prepare Add-ins and install it for users (Google for it if this is the case)

EDIT:

How to get add in in all opened files....

Goto File - Option - Quick Access Toolboar - From the dropdown "Choose Command from" - select Macros then select add-in macro - Add it, Below there would be a modify button Select the icon you like from it - OK

Now you will be able to see the icon with the addin function linked on top of the excel - click it for functioning, it will remain there forever ( if missed you can reapply the settings)....

The procedure are for 2010, for 2007 it should be similar....for 2003 there is a different way to achieve it...

Upvotes: 0

Related Questions