PC Review


Reply
Thread Tools Rate Thread

copying Excel file without opening file

 
 
windsurferLA
Guest
Posts: n/a
 
      19th Nov 2007
Can one copy an Excel workbook in a local directory to another directory
on a server (assuming no password is required) using a macro within an
unrelated Excel workbook without the file to be copied? This is what I
tried that did not work:

Sub BookMarkIt()
Dim SourceFile, DestinationFile

' Define source file name.

SourceFile = "C:\Documents and Settings\Michael\My
Documents\__ScratchDELL\_2007-11Nov\test1.xls"

' Define target file name.

DestinationFile =
"ftp://xx.xx.xxx.xxx/public_html/Actions/Nov18Test2.xls"


FileCopy SourceFile, DestinationFile

End Sub


I'm using Excel97, but I've found (probably as a result of various
updates) that I seem to have essentially all the capabilities of the
later versions of Excel, except for the most recent one. Furthermore, I
have found that once the password is entered, I can open and save files
from / to the server directory nearly as easily as if it was on a
local drive.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?YnJvcm8xODM=?=
Guest
Posts: n/a
 
      19th Nov 2007
hi,

I'd recommend incorporating a test for the (source & dest) file existence
before running the filecopy statement & the below function suggested by Ken
Puls works for me:

Public Function FileFolderExists(strFullPath As String) As Boolean
'Author : Ken Puls (www.excelguru.ca)
'Macro Purpose: Check if a file or folder exists
If Not Dir(strFullPath,vbDirectory) = vbNullString Then FileFolderExists
= True
End Function
(This was sourced from: http://www.excelguru.ca/node/30)

Using the above testing will possibly highlight a typo etc, but (& now I'm
guessing):
*Does Filecopy work for "FTP" servers?
*Do you need to change one of your file definition strings?
(ie change to both strings using backslashes, or both strings using forward
slashes)

hth
Rob

__________________
Rob Brockett
NZ
Always learning & the best way to learn is to experience...



"windsurferLA" wrote:

> Can one copy an Excel workbook in a local directory to another directory
> on a server (assuming no password is required) using a macro within an
> unrelated Excel workbook without the file to be copied? This is what I
> tried that did not work:
>
> Sub BookMarkIt()
> Dim SourceFile, DestinationFile
>
> ' Define source file name.
>
> SourceFile = "C:\Documents and Settings\Michael\My
> Documents\__ScratchDELL\_2007-11Nov\test1.xls"
>
> ' Define target file name.
>
> DestinationFile =
> "ftp://xx.xx.xxx.xxx/public_html/Actions/Nov18Test2.xls"
>
>
> FileCopy SourceFile, DestinationFile
>
> End Sub
>
>
> I'm using Excel97, but I've found (probably as a result of various
> updates) that I seem to have essentially all the capabilities of the
> later versions of Excel, except for the most recent one. Furthermore, I
> have found that once the password is entered, I can open and save files
> from / to the server directory nearly as easily as if it was on a
> local drive.
>

 
Reply With Quote
 
windsurferLA
Guest
Posts: n/a
 
      25th Nov 2007

Thanks for hint...


broro183 wrote:
> hi,
>
> I'd recommend incorporating a test for the (source & dest) file existence
> before running the filecopy statement & the below function suggested by Ken
> Puls works for me:
>
> Public Function FileFolderExists(strFullPath As String) As Boolean
> 'Author : Ken Puls (www.excelguru.ca)
> 'Macro Purpose: Check if a file or folder exists
> If Not Dir(strFullPath,vbDirectory) = vbNullString Then FileFolderExists
> = True
> End Function
> (This was sourced from: http://www.excelguru.ca/node/30)
>
> Using the above testing will possibly highlight a typo etc, but (& now I'm
> guessing):
> *Does Filecopy work for "FTP" servers?
> *Do you need to change one of your file definition strings?
> (ie change to both strings using backslashes, or both strings using forward
> slashes)
>
> hth
> Rob
>
> __________________
> Rob Brockett
> NZ
> Always learning & the best way to learn is to experience...
>
>
>
> "windsurferLA" wrote:
>
>> Can one copy an Excel workbook in a local directory to another directory
>> on a server (assuming no password is required) using a macro within an
>> unrelated Excel workbook without the file to be copied? This is what I
>> tried that did not work:
>>
>> Sub BookMarkIt()
>> Dim SourceFile, DestinationFile
>>
>> ' Define source file name.
>>
>> SourceFile = "C:\Documents and Settings\Michael\My
>> Documents\__ScratchDELL\_2007-11Nov\test1.xls"
>>
>> ' Define target file name.
>>
>> DestinationFile =
>> "ftp://xx.xx.xxx.xxx/public_html/Actions/Nov18Test2.xls"
>>
>>
>> FileCopy SourceFile, DestinationFile
>>
>> End Sub
>>
>>
>> I'm using Excel97, but I've found (probably as a result of various
>> updates) that I seem to have essentially all the capabilities of the
>> later versions of Excel, except for the most recent one. Furthermore, I
>> have found that once the password is entered, I can open and save files
>> from / to the server directory nearly as easily as if it was on a
>> local drive.
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for Opening Reuters, Opening Excel File, Closing Excel File Tsp245 Microsoft Excel Programming 2 14th Aug 2008 07:24 PM
reading txt file and copying the lines in new excel file shresthaprateek@gmail.com Microsoft Excel Programming 2 11th Aug 2006 07:20 PM
opening an excel file opens a duplicate file of the same file =?Utf-8?B?c2tt?= Microsoft Excel Misc 1 7th Dec 2005 05:52 PM
Unable to read file" error when opening a file with Excel-2000 =?Utf-8?B?UGFua2Fq?= Microsoft Excel Crashes 0 16th Jun 2005 06:54 PM
Error opening or copying Excel File Miscell04 Microsoft Excel Misc 1 14th Jun 2004 06:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:21 AM.