Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2005, 01:32 PM
Authorized User
 
Join Date: Oct 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Moving a file

Is it possible to move an Excel file which is open and running VBA code from one directtory to another?

i.e the VBA code moves the .xls file it is running from.

 
Old January 14th, 2005, 02:06 AM
Authorized User
 
Join Date: Jan 2005
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes! it's possible in Three steps

VBA code must store Activeworkbook.path & "\" & activeworkbook.name to a string variable previousFile

Next Save the current file to new location (e.g activeworkbook.save \dfdkf\dfkdfk)

Next Kill previousFile

The file is moved! WoW!

Regards
Amjad Mahmood

 
Old January 14th, 2005, 10:49 AM
Authorized User
 
Join Date: Oct 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah! Good idea. Done & works fine thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving files based on an Excel file sachtaridis Excel VBA 1 November 26th, 2007 12:39 PM
Moving an ellipse ironchef Java GUI 0 November 2nd, 2006 06:20 PM
Moving Tags stefan.yu XSLT 1 February 22nd, 2006 03:44 PM
moving a SQL Server v7 db file lcsgeek Classic ASP Databases 1 May 5th, 2004 01:23 PM
Moving around a recordset Blaise Classic ASP Databases 6 June 25th, 2003 06:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.