ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move them to different folder (https://www.excelbanter.com/excel-programming/299037-move-them-different-folder.html)

Prasad Vanka

Move them to different folder
 
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

yogendra joshi

Move them to different folder
 
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


Prasad Vanka wrote:

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



Bob Phillips[_6_]

Move them to different folder
 
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)

"yogendra joshi" wrote in message
...
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


Prasad Vanka wrote:

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






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

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