Use one macro in different excel files

I wrote a macro that I would like to use in different excel files that have almost the same table structure but different data.

So is it even possible to "include" my script macro in any excel file ?!

I already read this tip , but it sounds like a bad joke to me.

thank

+4
source share
5 answers

Excel (.xla) . Tools>Add-ins, . , , , . , Alt + F8 Tools>Macro. . . http://spreadsheetpage.com/index.php/tip/creating_custom_menus/

, , PERSONAL.XLS Excel 2007-2010 PERSONAL.XLSB. XLSTART .

, Excel. , , , Excel.

- , " ".

(Alt + F9), PERSONAL.XLS. ,

Public Sub Testing()
    MsgBox "Hey im from Personal.xls"
End Sub

PERSONAL.XLS (Window>>Hide). .

+8

;

1) .xlsb, , ,

2) , excel . , - .

, , , .

, , , .

.

+2

personnal.xls , Excel () "" . < > , . : Thisworkbook Activeworkbook.

+1

, - "" XLSM, , . , , Excel . / (), .. , , . - ... .

Sub MultipleFileMacro()

Dim wb As Excel.Workbook
Dim fso As Scripting.FileSystemObject
Dim f As Scripting.File

   Set fso = New Scripting.FileSystemObject
   For Each f In fso.GetFolder("c:\samplefolder").Files
      Set wb = Excel.Workbooks.Open(f)

      MyMacro wb

      wb.Close
   Next f

End Sub
------------
Sub MyMacro(wb As Excel.Workbook)

   'do something here

End Sub
+1

, AddIn Personal. Xlsb, , , , , ☺

0

All Articles