Solved

Copy file and rename 110 times, increment filename by 1 each time?

Posted on 2006-07-06
2
281 Views
Last Modified: 2008-03-17
I have an Excel spreadsheet called 1.xls

Is there a bit of vbs to copy this file and call it 2.xls, then 3.xls, then 4.xls and so on - 110 times, to 110.xls?

Thanks
Lapchien
0
Comment
Question by:Lapchien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 500 total points
ID: 17049474
Easy

If you have the location

public sub copy100

dim fileName as string
dim outputLoc as string
dim lngLc as long

fileName = "C:\xxx\1.xls"
outputLoc = "C:\xxx\"

for lngLC = 2 to 110
    filecopy filename, outputLoc & lnglc & ".xls"
next lngLc

end sub
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17049484
Sory the sub should be public sub copy100 ()

This goes through the numbers in the selected range and copies from the fileName to the outputLocation - and the name of the file is just the number - if you want it to be numbered 002 to 110 then you would use a format statement in th filecopy
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question