Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have several excel documents (templates) all with the name
xxx_Testprotocol1, xxx_Testprotocol2 etc. For each test campaign I need to replace the xxx at the beginning with the name of the testcampaign e.g. RC27_Testprotocol1. Is there a way of automating this since doing it manually is quite time consuming. Cheers Silvie |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Use code below. Read comments and change Folder as required.
Sub MakeCopy() Folder = "c:\temp\" 'get all xlt files TestCampaign = InputBox("Enter test Campaign : ") FName = Dir(Folder & "*.xlt") Do While FName < "" 'make sure xlt files start with XXX If UCase(Left(FName, 3)) = "XXX" Then 'remove extension BaseName = Left(FName, InStr(FName, ".") - 1) 'remove three XX at the geginning of name BaseName = Mid(BaseName, 4) 'copy file and change extension from xlt to xls FileCopy Source:=Folder & FName, _ Destination:=Folder & TestCampaign & BaseName & "xls" End If FName = Dir() Loop End Sub "Silvie" wrote: I have several excel documents (templates) all with the name xxx_Testprotocol1, xxx_Testprotocol2 etc. For each test campaign I need to replace the xxx at the beginning with the name of the testcampaign e.g. RC27_Testprotocol1. Is there a way of automating this since doing it manually is quite time consuming. Cheers Silvie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
turning 2007 excel documents into 2003 excel documents | Excel Discussion (Misc queries) | |||
How do I change properties for all new documents in Excel? | Excel Discussion (Misc queries) | |||
Conditional Format: Expired dates wanting cell to change color | Excel Discussion (Misc queries) | |||
excel documents won't open from my documents folder | Excel Discussion (Misc queries) | |||
Moving Excel Charts into Word Documents: font sizes change | Charts and Charting in Excel |