BhBp_SaveAsCopy

Hello, for experimental purpose I use code below to create 3000 - 300000 files. This process is to slow and it's seems, that PC hangs.
Please, help me to improve this code to work faster.

Sub BhBp_SaveAsCopy()
For X = 1 To 3000
ActiveDocument.SaveAsCopy ActiveDocument.FilePath & "DOCUMENT_" & String(10 - Len(X), "0") & X & ".cdr"
Next
End Sub

Greetings!

Parents
No Data
Reply
  • I see you like to load the computer with unnecessary work. Try the code below.

    Sub FileCloning()
         Dim DirFrom$, FileFrom$, DirTo$, FileTo$, X&

         DirFrom = ActiveDocument.FilePath
         FileFrom = ActiveDocument.Name
         DirTo = DirFrom

         For X = 1 To 3000
              FileTo = Right("0000000000" & X, 10) & ".cdr"
              FileCopy DirFrom & FileFrom, DirTo & FileTo
         Next X
    End Sub

    For the purity of the experiment use =format ะก:= please!
    (this is a joke. Don't do that.)

Children