"Name" Keyword ?

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

I cannot find information on what the VBA keyword "Name" means, as
in:

Name FileName As FileName

Can someone help me out? The complete code is shown below.

Thanks, Alan

Private Function CheckFileCreated(FileName As String) As Boolean
On Error GoTo ErrorHandler
CheckFileCreated = False
Name FileName As FileName
CheckFileCreated = True
ErrorHandler:
End Function
 
Search VBA's help for "rename"

Then click on the link to "name statement"

(or just search for "name statement" directly)
 
The Name statement renames an existing file. The basic syntax is

Name Original_File_Name As New_File_Name

For example, the following code renames "C:\Book1.xls" to
"C:\BookOne.xls":

Name "C:\Book1.xls" As "C:\BookOne.xls"

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Type Name in the Immediate window, press F1 and select the item for the VBA Library (it is 1st item in my list).
 
Back
Top