Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How do I copy a folder from a server using a macro

I need to copy files and folders from a server to my hard drive using a
macro. I'm not sure how to write the macro using visual basic.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How do I copy a folder from a server using a macro

Same as in DOS except using the FileCopy command

FileCopy "source", "destination"
--
HTH...

Jim Thomlinson


"macrowriter" wrote:

I need to copy files and folders from a server to my hard drive using a
macro. I'm not sure how to write the macro using visual basic.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How do I copy a folder from a server using a macro

FILECOPY C:\DOCUMENTS\QUIZ april.doc , C:\ARCHIVED\DOCUMENTS\TEST april.doc
here is what I'm trying to do.... am i missing anything?
"Jim Thomlinson" wrote:

Same as in DOS except using the FileCopy command

FileCopy "source", "destination"
--
HTH...

Jim Thomlinson


"macrowriter" wrote:

I need to copy files and folders from a server to my hard drive using a
macro. I'm not sure how to write the macro using visual basic.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How do I copy a folder from a server using a macro

Since the files names have spaces in them throw quotes aroung them...

FILECOPY "C:\DOCUMENTS\QUIZ april.doc" , "C:\ARCHIVED\DOCUMENTS\TEST
april.doc"

--
HTH...

Jim Thomlinson


"macrowriter" wrote:

FILECOPY C:\DOCUMENTS\QUIZ april.doc , C:\ARCHIVED\DOCUMENTS\TEST april.doc
here is what I'm trying to do.... am i missing anything?
"Jim Thomlinson" wrote:

Same as in DOS except using the FileCopy command

FileCopy "source", "destination"
--
HTH...

Jim Thomlinson


"macrowriter" wrote:

I need to copy files and folders from a server to my hard drive using a
macro. I'm not sure how to write the macro using visual basic.

  #5   Report Post  
Posted to microsoft.public.excel.programming
KtM KtM is offline
external usenet poster
 
Posts: 13
Default How do I copy a folder from a server using a macro

You are missing "", ie
filecopy "what","to"
for example.
filecopy "c:\test.xls","c:\test2.xls"
or use same method as VBA example and use variables, which makes it
easier to change if used repeatedly.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How do I copy a folder from a server using a macro

This was very helpful... here is what I have sofar... however I can only seem
to move one file at a time. how can I change this to move all files in the
folder?

Sub FileCopyExample()
Dim sSourcePath As String
Dim sTargetPath As String

' Change these paths to your Source and Target paths.
sSourcePath = "C:\PNTTEMPL\CustomDoc\CHARM.PCD"
sTargetPath = "C:\PNTTEMPL\CustomDoc\TEST\CHARM.PCD"
On Error Resume Next

' Copy the file "My Document" file from "Macintosh HD:Documents"
' to "Macintosh HD:Backup".
FileCopy sSourcePath, sTargetPath

If Err 0 Then MsgBox Err.Description
End Sub


"KtM" wrote:

You are missing "", ie
filecopy "what","to"
for example.
filecopy "c:\test.xls","c:\test2.xls"
or use same method as VBA example and use variables, which makes it
easier to change if used repeatedly.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default How do I copy a folder from a server using a macro

Check out this page:

http://www.rondebruin.nl/folder.htm

"macrowriter" wrote:

This was very helpful... here is what I have sofar... however I can only seem
to move one file at a time. how can I change this to move all files in the
folder?

Sub FileCopyExample()
Dim sSourcePath As String
Dim sTargetPath As String

' Change these paths to your Source and Target paths.
sSourcePath = "C:\PNTTEMPL\CustomDoc\CHARM.PCD"
sTargetPath = "C:\PNTTEMPL\CustomDoc\TEST\CHARM.PCD"
On Error Resume Next

' Copy the file "My Document" file from "Macintosh HD:Documents"
' to "Macintosh HD:Backup".
FileCopy sSourcePath, sTargetPath

If Err 0 Then MsgBox Err.Description
End Sub


"KtM" wrote:

You are missing "", ie
filecopy "what","to"
for example.
filecopy "c:\test.xls","c:\test2.xls"
or use same method as VBA example and use variables, which makes it
easier to change if used repeatedly.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a folder by macro Brettjg Excel Discussion (Misc queries) 6 March 19th 07 10:51 PM
Macro to create a folder and copy files GainesvilleWes New Users to Excel 2 February 26th 07 06:33 PM
How to copy 30 csv files from a folder to another folder ddiicc Excel Programming 1 July 17th 05 09:42 AM
Macro to copy range from Excel files in folder nc Excel Discussion (Misc queries) 1 June 15th 05 11:11 AM
Create Folder / Copy Folder / Replace Murray Outtrim[_2_] Excel Programming 0 February 24th 04 06:40 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"