View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
smonczka smonczka is offline
external usenet poster
 
Posts: 29
Default Need help with my code!

I have to duplicate a file about 1500 times with unique names. I am
trying to write a macro that will automatically save the file as
excel(X).xls where (X) is auto generated for as many times as I need.

I am new to basic but what I have cobbled together from different posts
is ...

Dim X As Long
Dim sFilename As String
For X = 1 To 1500
With ActiveWorkbook.(X)
sFilename = "http://intranet/deptSales/excel" & CStr(X) & ".xls"
ActiveWorkbook.SaveAs
End With
Next

If someone wouldn't mind telling me what have I got wrong?

Thanks for the help,
Steve