ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Renaming Files w/Excel (https://www.excelbanter.com/excel-discussion-misc-queries/180856-renaming-files-w-excel.html)

Confused VB Person

Renaming Files w/Excel
 
I have a simple spreadsheet with 2 columns: Column A has original file names
for a bunch of Acorbat (.pdf) files while Column B has the new filename. I
want to read each row, get the original final name from Column A, rename the
old file to the new one whose name I have specified in Column B.

Is there a simple VBA that can take care of this? Thanks in advance!

Gary''s Student

Renaming Files w/Excel
 
Perhaps:

Sub ordinate()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
Name cell.Value As cell.Offset(0, 1).Value
Next cell
End Sub

--
Gary''s Student - gsnu200775


"Confused VB Person" wrote:

I have a simple spreadsheet with 2 columns: Column A has original file names
for a bunch of Acorbat (.pdf) files while Column B has the new filename. I
want to read each row, get the original final name from Column A, rename the
old file to the new one whose name I have specified in Column B.

Is there a simple VBA that can take care of this? Thanks in advance!


Confused VB Person

Renaming Files w/Excel
 
Thanks for the fast response. But I forgot to mention that I use Excel in
Office2003. Will your VBA work with this version?

"Gary''s Student" wrote:

Perhaps:

Sub ordinate()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
Name cell.Value As cell.Offset(0, 1).Value
Next cell
End Sub

--
Gary''s Student - gsnu200775


"Confused VB Person" wrote:

I have a simple spreadsheet with 2 columns: Column A has original file names
for a bunch of Acorbat (.pdf) files while Column B has the new filename. I
want to read each row, get the original final name from Column A, rename the
old file to the new one whose name I have specified in Column B.

Is there a simple VBA that can take care of this? Thanks in advance!


Confused VB Person

Renaming Files w/Excel
 
I ran your VBA macro and got this error message: "Run-time error 53: File not
found". My question is how do I explicitly call the file which I read from
my spreadsheet?



"Confused VB Person" wrote:

Thanks for the fast response. But I forgot to mention that I use Excel in
Office2003. Will your VBA work with this version?

"Gary''s Student" wrote:

Perhaps:

Sub ordinate()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
Name cell.Value As cell.Offset(0, 1).Value
Next cell
End Sub

--
Gary''s Student - gsnu200775


"Confused VB Person" wrote:

I have a simple spreadsheet with 2 columns: Column A has original file names
for a bunch of Acorbat (.pdf) files while Column B has the new filename. I
want to read each row, get the original final name from Column A, rename the
old file to the new one whose name I have specified in Column B.

Is there a simple VBA that can take care of this? Thanks in advance!


Gary''s Student

Renaming Files w/Excel
 
In cell A1 enter:
C:\Documents and Settings\Owner\Desktop\helper.xls
In cell B1 enter:
C:\Documents and Settings\Owner\Desktop\helper2.xls

and the rename is performed

--
Gary''s Student - gsnu200775


"Confused VB Person" wrote:

I ran your VBA macro and got this error message: "Run-time error 53: File not
found". My question is how do I explicitly call the file which I read from
my spreadsheet?



"Confused VB Person" wrote:

Thanks for the fast response. But I forgot to mention that I use Excel in
Office2003. Will your VBA work with this version?

"Gary''s Student" wrote:

Perhaps:

Sub ordinate()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
Name cell.Value As cell.Offset(0, 1).Value
Next cell
End Sub

--
Gary''s Student - gsnu200775


"Confused VB Person" wrote:

I have a simple spreadsheet with 2 columns: Column A has original file names
for a bunch of Acorbat (.pdf) files while Column B has the new filename. I
want to read each row, get the original final name from Column A, rename the
old file to the new one whose name I have specified in Column B.

Is there a simple VBA that can take care of this? Thanks in advance!



All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com