If you successfully changed Trust Access to VBA model and marked reference as checked, then code part in your Module1 is as follows:
Option Explicit
Sub zz()
If Cells(Rows.Count, 1).End(xlUp).Row < 8 Then MsgBox "No data for ...": Exit Sub
'...
Next
Next
' changed xlsx to xlsm twice
If Len(Dir(p & k & ".xlsm")) Then
affirm = MsgBox("Record of " & k & " existing, accumulate to it or not?", vbYesNo)
f = Dir(p & k & ".xlsm")
Workbooks.Open p & f
'...
Myr = 7 + UBound(br)
GoSub Fula
'added call to copymodule - code of this module is pasted below current sub
'source: https://stackoverflow.com/questions/40956465/vba-to-copy-module-from-one-excel-workbook-to-another-workbook
Call CopyModule(ThisWorkbook, "Module2", ActiveWorkbook)
'changed 51 to 52
ActiveWorkbook.SaveAs p & k, FileFormat:=52
End If
'...
Return
End Sub
'and code from above link just pasted below:
Public Sub CopyModule(SourceWB As Workbook, strModuleName As String, TargetWB As Workbook)
' Description: copies a module from one workbook to another
' example: CopyModule Workbooks(ThisWorkbook), "Module2",
' Workbooks("Food Specials Rolling Depot Memo 46 - 01.xlsm")
' Notes: If Module to be copied already exists, it is removed first,
' and afterwards copied
Dim strFolder As String
Dim strTempFile As String
Dim FName As String
'...
See also attached file - I tested it and it prepares set of 8 new xlsm files with Module2 inside.
Bookmarks