HelpPlease7
05-20-2014, 04:08 PM
I have a word document that i need to duplicate 200 times with the filename ending in consecutive numbers.
file1
file2
file3....file200
thanks
macropod
05-20-2014, 07:37 PM
Try something based on:
Sub Make200()
Application.ScreenUpdating = False
Dim i As Long, StrPath As String, StrExt As String, lFmt As Long
With ActiveDocument
StrPath = .Path & "\": lFmt = .SaveFormat
StrExt = "." & Split(.Name, ".")(UBound(Split(.Name, ".")))
For i = 1 To 200
.SaveAs2 FileName:=StrPath & Format(i, "000") & StrExt, _
Fileformat:=lFmt, AddToRecentFiles:=False
Next
End With
Application.ScreenUpdating = True
End Sub
If you need to prefix the number with some text, simply add that after the '\' in:
StrPath = .Path & "\"
Note: The code assumes the active document is the one you want to replicate.
HelpPlease7
05-21-2014, 05:10 AM
Thank you!
Does exactly what I wanted.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.