![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Can anyone help me with the code to move a file from one directory to another i.e.
Moving C:testtest.xls to C:test.xls Thanks in advance Matt |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
Assuming the destination directory already exists. Name "C:testtest.xls" As "C:test.xls" Tom |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Thanks Tom, on the same subject, how would I move all files from one directory to another, have tried
Name "Ccurrent*.*" As "C:saved*.*" with no success Matt |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi Matt
Which version of office are you using? Tom |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Office 97
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi Matt
I do not know how to work with files in Office 97. Do a file search on your computer for a file called scrrun.dll. Should be in system folder. Microsoft Scripting Runtime If you have it, I can help you. If not then someone else will... Tom |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Hi Tom
Yes I have that file |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Try this
Sub MoveFiles() Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") 'creates the destination directory if it does not exist fso.MoveFolder "C:Current", "C:Saved" End Sub Tom |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Feb 2002
Location: England
Posts: 212
|
Thanks Tom
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|