OldPedant
Thu Jul 10 17:43:05 CDT 2008
You could pretty easily do this, by just scanning all the files in the
directory and doing a replace. What I would do, though, is set up
"prototype" files (e.g., named ".xsl.proto") and have an easy-to-find token
string in each where the URL needs to go (e.g.,
<url>######</url>
and then just replace the token string with this week's url and write the
result to a file with the same name but stripping off the ".proto".
So:
newURL = "
http://rwx.squadron.com/" ' or get it from command line or whatever
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fldr = FSO.GetFolder("c:\full\path\")
For Each fil In fldr.Files
fname = fil.Name
If Right(fname,6) = ".proto" Then
Set infile = FSO.OpenTextFile( fil.Path )
Set outfile = FSO.CreateTextFile( Left( fil.Path, LEN(fil.Path)-6
), True )
outfile.Write = Replace( infile.ReadAll, "######", newURL ) )
outfile.Close
infile.Close
End If
Next
Or something close to that, at least. That's just off the top of my head.
"Argus Rogue" wrote:
> Hello All,
>
> I have a directory that has several XLS files all uniquely named. In each
> XLS file there is a Header called URL. Under that header is a URL link
> that I would like to change (Example:
http://rwa.squadron.com/...) in each
> XLS file located in that directory.
>
> Each week the only thing changing in the url would be the first part of the
> URL rwa would change to rwb. Next week that would change to rwc and the
> week after that to rwd.
>
> Is there a way to prompt the user to enter the new url and then traverse
> through the directory and go into each excel file and change the url to the
> one that was entered in by the user? In some cases, an excel file will have
> multiple rows with an url address, it would have to change them as well.
>
> Any and all help in this matter is greatly appreciated.
>
> Argus
>
>
>