Excel 2007 macro that replicates files based on list but saves as .xlsx "macro free workbook"

sweetwalt

New Member
Joined
Aug 4, 2011
Messages
8
I've been searching the posts (seems like a question that would be recurring), but I can't find an answer...

I have an excel workbook that contains a list of file names in a hidden column (ak). I am using the following code (worked great in Excel 2003), but it doesn't work quite right in excel 2007. When it replicates the file, I wanted it to save as a .xlsx or .xls that is macro free so the user doesn't get a warning message when it opens up...

Thank you in advance for you help!

Note: Example filename in column AK = JohnDoe123.xls

Code:
Sub A_File_Replication()'This macro replicates a file based on a list.- Module 2


'List should be located in a hidden column AK of the active sheet


'Update n = 2 to 98 to list lenghth (i.e., 100 file names in cells
'AK1 to AK100) then n = 1 to 100


'Create the folder C:\MACROS\FILES on your hardrive before running from
'the active sheet with the files listed in column AK


ActiveWorkbook.Save
Dim x As String
For n = 1 To 122
x = ActiveWorkbook.ActiveSheet.Range("AK" & n).Value
ActiveWorkbook.SaveAs ("C:\MACROS\FILES\" & x)
Application.DisplayAlerts = TRUE
Application.ScreenUpdating = True


Next n
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,465
Messages
6,124,982
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top