Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Is there a way to use a macro in a workbook to move a file from one folder to
another folder by copying it? I tried to record a macro to do it but nothing shows up in the VB editor. Thanks Dave |
#2
![]() |
|||
|
|||
![]()
Yes there is- how do you want to handle the files? For instance, do
you want to save the original file in the original location, and make a copy of the file to the new folder? Or do you want to skip right to the Save As to the new folder, and delete the file from the original location? It's easily done, and for the most part can be accomplished by recording the macro. Why the macro didn't show up in the editor is troublesome but most likely easily overcome. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave - I want to do exactly what you have outlined here. I want to do the
save as and delete the file from the original location. I used record macro and the save-as worked just fine. The delete file is the part I am having trouble with. All I could think to do was a file-open and then delete the file there. It didn't work. It just gave me the ChDir and leaves the original file there. What do you suggest? Pam "Dave O" wrote: Yes there is- how do you want to handle the files? For instance, do you want to save the original file in the original location, and make a copy of the file to the new folder? Or do you want to skip right to the Save As to the new folder, and delete the file from the original location? It's easily done, and for the most part can be accomplished by recording the macro. Why the macro didn't show up in the editor is troublesome but most likely easily overcome. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Pam,
Dim myFName As String myFName = ActiveWorkbook.Fullname 'or use some other workbook object that points to the file 'Do your SaveAs, then use Kill myFName HTH, Bernie MS Excel MVP "Pam M" wrote in message ... Dave - I want to do exactly what you have outlined here. I want to do the save as and delete the file from the original location. I used record macro and the save-as worked just fine. The delete file is the part I am having trouble with. All I could think to do was a file-open and then delete the file there. It didn't work. It just gave me the ChDir and leaves the original file there. What do you suggest? Pam "Dave O" wrote: Yes there is- how do you want to handle the files? For instance, do you want to save the original file in the original location, and make a copy of the file to the new folder? Or do you want to skip right to the Save As to the new folder, and delete the file from the original location? It's easily done, and for the most part can be accomplished by recording the macro. Why the macro didn't show up in the editor is troublesome but most likely easily overcome. |
#5
![]() |
|||
|
|||
![]()
Hi Dave
Try the following? Sub SaveCopy() ChDir "C:\Documents and Settings\{Enter new Directory name here}" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\{Enter new directory and file name here}, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub This is the result of running Macro Record, but you can adapt it to suit your needs. -- ve_2nd_at. Randburg, Gauteng, South Africa "Dave" wrote: Is there a way to use a macro in a workbook to move a file from one folder to another folder by copying it? I tried to record a macro to do it but nothing shows up in the VB editor. Thanks Dave |
#6
![]() |
|||
|
|||
![]()
Actually one of the easier things to do.
Sub movefile() OldName = "C:\oldfoldername\1065.xls" NewName = "C:\newfoldername\1065.xls" Name OldName As NewName End Sub -- Don Guillett SalesAid Software "Dave" wrote in message ... Is there a way to use a macro in a workbook to move a file from one folder to another folder by copying it? I tried to record a macro to do it but nothing shows up in the VB editor. Thanks Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA to move an excel file to another folder | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) | |||
move to another cell within a subtotal report within a macro | Excel Worksheet Functions | |||
Problem Editing Macro in Shared Excel File | Excel Discussion (Misc queries) | |||
creat a macro to look for a file | Excel Discussion (Misc queries) |