Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could someone please explain how this Excel 2003 VBA routine works to rename
a file. Assume oldfilename.txt exist in the C:\temp directory, when the name statement executes, it is renamed to "newfilename.txt" Sub RenameTheFiles() ChDir "C:\Temp\" Name "oldfilename.txt" As "newfilename.txt" End Sub Originally I was using a multi step routine using the FileSystemObject and setting a fileObject.Name = new name, thus performing the rename. The simplicity of this code is confusing what I thought I knew about the object models. Specifically, Name in the above routine is a method? How is it associated, what is the object or how does it know to rename the file in the temp directory??? Can anyone give me the complete syntax of the name statement? I assume there to be several defaults omitted. What role does the "AS" play? Is this some kind of shorthand for a SET statement? Puzzled! Fred Krause. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with renaming work sheet name | Excel Discussion (Misc queries) | |||
VB file renaming. | Excel Worksheet Functions | |||
renaming all work-sheets at once | Excel Discussion (Misc queries) | |||
vb code for renaming a work sheet with a cell reference | Excel Discussion (Misc queries) | |||
Renaming a file | Excel Programming |