Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Can someone point me in the right direction please. I want to copy an access database from one disk location to another using VBA. The reason for this is that I have an odbc link to a database and I want to use it to read a different database without having to rebuild the query. I have found that for me the easiest way to do this is to copy the live database into a temporary location which msquery can read, then to change the database just copy the new database over the top. But I want to do this all from within excel. So any pointerswould be appreciated. Many Thanks Chris |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chris, you can call the following function or just insert the "FileCopy" line
where you want it and replace the arguments with the full paths (i.e. drive, path, file name, file extension): Public Function FileCopy(argFullSourceName As String, argFullDestinationName As String) 'COPY A CLOSED FILE FROM ONE FOLDER TO ANOTHER; FileCopy argFullSourceName, argFullDestinationName End Function HTH "Chris Ferguson" wrote: Hi Can someone point me in the right direction please. I want to copy an access database from one disk location to another using VBA. The reason for this is that I have an odbc link to a database and I want to use it to read a different database without having to rebuild the query. I have found that for me the easiest way to do this is to copy the live database into a temporary location which msquery can read, then to change the database just copy the new database over the top. But I want to do this all from within excel. So any pointerswould be appreciated. Many Thanks Chris |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this should do it
Sub movefile() OldName = "C:\oldfolder\1065.xls" NewName = "C:\newfolder\1065.xls" Name OldName As NewName End Sub -- Don Guillett SalesAid Software "Chris Ferguson" wrote in message ... Hi Can someone point me in the right direction please. I want to copy an access database from one disk location to another using VBA. The reason for this is that I have an odbc link to a database and I want to use it to read a different database without having to rebuild the query. I have found that for me the easiest way to do this is to copy the live database into a temporary location which msquery can read, then to change the database just copy the new database over the top. But I want to do this all from within excel. So any pointerswould be appreciated. Many Thanks Chris |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just some added info:
Even though the OP said move in his subject, he said copy in the body. the Name command will move the file. The Filecopy command will copy it. -- Regards, Tom Ogilvy "Don Guillett" wrote in message ... this should do it Sub movefile() OldName = "C:\oldfolder\1065.xls" NewName = "C:\newfolder\1065.xls" Name OldName As NewName End Sub -- Don Guillett SalesAid Software "Chris Ferguson" wrote in message ... Hi Can someone point me in the right direction please. I want to copy an access database from one disk location to another using VBA. The reason for this is that I have an odbc link to a database and I want to use it to read a different database without having to rebuild the query. I have found that for me the easiest way to do this is to copy the live database into a temporary location which msquery can read, then to change the database just copy the new database over the top. But I want to do this all from within excel. So any pointerswould be appreciated. Many Thanks Chris |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Brilliant, thanks guys, the copyfile was exactly what I wanted.
Why is it so obvious, just after it has been pointed out? Chris "Tom Ogilvy" wrote in message ... Just some added info: Even though the OP said move in his subject, he said copy in the body. the Name command will move the file. The Filecopy command will copy it. -- Regards, Tom Ogilvy "Don Guillett" wrote in message ... this should do it Sub movefile() OldName = "C:\oldfolder\1065.xls" NewName = "C:\newfolder\1065.xls" Name OldName As NewName End Sub -- Don Guillett SalesAid Software "Chris Ferguson" wrote in message ... Hi Can someone point me in the right direction please. I want to copy an access database from one disk location to another using VBA. The reason for this is that I have an odbc link to a database and I want to use it to read a different database without having to rebuild the query. I have found that for me the easiest way to do this is to copy the live database into a temporary location which msquery can read, then to change the database just copy the new database over the top. But I want to do this all from within excel. So any pointerswould be appreciated. Many Thanks Chris |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Brilliant.
Thats just what I wanted. Thanks very much. "Tom Ogilvy" wrote in message ... Just some added info: Even though the OP said move in his subject, he said copy in the body. the Name command will move the file. The Filecopy command will copy it. -- Regards, Tom Ogilvy "Don Guillett" wrote in message ... this should do it Sub movefile() OldName = "C:\oldfolder\1065.xls" NewName = "C:\newfolder\1065.xls" Name OldName As NewName End Sub -- Don Guillett SalesAid Software "Chris Ferguson" wrote in message ... Hi Can someone point me in the right direction please. I want to copy an access database from one disk location to another using VBA. The reason for this is that I have an odbc link to a database and I want to use it to read a different database without having to rebuild the query. I have found that for me the easiest way to do this is to copy the live database into a temporary location which msquery can read, then to change the database just copy the new database over the top. But I want to do this all from within excel. So any pointerswould be appreciated. Many Thanks Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I still recover a file I saved in USB Flash disk from my HDD? | Excel Discussion (Misc queries) | |||
Save a file to disk without re-formating the disk | Excel Discussion (Misc queries) | |||
File has grown to 300,000 KB on Disk | Excel Discussion (Misc queries) | |||
missing MSOCache file not on program disk | Setting up and Configuration of Excel | |||
Download files from 3.5 disk in excel but system said disk need fo | Excel Discussion (Misc queries) |