Move them to different folder

  • Thread starter Thread starter Prasad Vanka
  • Start date Start date
P

Prasad Vanka

Hi,

Is there any way, using Excel VBA code, we can move a worksheet from
one folder on the system to another. Can someone give me an example
code.

Thanks in advance
Prasad Vanka
 
Sub move()
Dim path As String
Dim fil_nam As String

path = "D:/" ' Specify Path you want to move to, you can also do this by
'passing a vairable
fil_nam = ActiveWorkbook.Name
del_file = ActiveWorkbook.FullName

ActiveWorkbook.SaveAs (path & fil_nam)
Kill ActiveWorkbook.Name
End Sub
 
More simply

name "C:\myTest\Volker1.xls" as "C:\NewDir\Volker99.xls"

note that NewDir must exist already.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top