Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd like to be able to automatically export all VBA modules from any
workbook I create whenever I save. I created the following function that does the export correctly, but now I want this code to be AUTOMATICALLY loaded into EVERY .xls I create. Is there a clean way to do this? Thanks in advance ------------------------ Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim VBComp As VBIDE.VBComponent Dim Sfx As String For Each VBComp In ActiveWorkbook.VBProject.VBComponents Select Case VBComp.Type Case vbext_ct_ClassModule, vbext_ct_Document Sfx = ".cls" Case vbext_ct_MSForm Sfx = ".frm" Case vbext_ct_StdModule Sfx = ".bas" Case Else Sfx = "" End Select If Sfx < "" Then VBComp.Export _ Filename:=ActiveWorkbook.Path & "\" & VBComp.Name & Sfx End If Next VBComp End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Basic question - modules and class modules - what's the difference? | Excel Programming | |||
HELP WITH AUTO EXPORT FROM OUTLOOK TO EXCEL | Excel Worksheet Functions | |||
Is it possible to export the (Excel) auto correct "dictionary" to. | Excel Discussion (Misc queries) | |||
Export auto correct dictionary | Excel Discussion (Misc queries) | |||
When to code in sheet or userform modules and when to use modules | Excel Programming |