Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Filecopy in vba macro

Hi,

I am trying to write vba macro using Filecopy but I always
get an error (file not found) while reading the file in
the folder. Is FILECOPY are Upper or Lower case
sensitive? If yes, What is the command that uses or
interprete wether it is a lower or upper case?

here's my code:
Dim a as string
Dim b as string
atemp = "c:\temp\myfile\"
btemp = "d:\temp\yourfile\"
ctemp = "Datafile.dat"

FILECOPY atemp & ctemp, btemp & ctemp

Appreciate your help.

Thanks in advance.
Jodie

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Filecopy in vba macro

It's not case sensitive for me. (win98 now, and I've never worried about case
sensitivity in winNT, either.)

Any chance that your datafile.dat is hidden? If you go to windows explorer and
go to that folder and rightclick on the file, select properties, do you see a
check mark in the Hidden property?

Jodie wrote:

Hi,

I am trying to write vba macro using Filecopy but I always
get an error (file not found) while reading the file in
the folder. Is FILECOPY are Upper or Lower case
sensitive? If yes, What is the command that uses or
interprete wether it is a lower or upper case?

here's my code:
Dim a as string
Dim b as string
atemp = "c:\temp\myfile\"
btemp = "d:\temp\yourfile\"
ctemp = "Datafile.dat"

FILECOPY atemp & ctemp, btemp & ctemp

Appreciate your help.

Thanks in advance.
Jodie


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Filecopy in vba macro

Your original code worked ok for me (assuming that the FromFile actually existed
and the to folder existed). I don't have a D: drive, so I made that adjustment,
too.

How about adding a few more checks to see where it blows up:

Option Explicit
Sub testme01()

Dim aTemp As String
Dim bTemp As String
Dim cTemp As String

aTemp = "c:\temp\myfile\"
bTemp = "D:\temp\yourfile\"
cTemp = "Datafile.dat"

If Dir(aTemp & cTemp) = "" Then
MsgBox "From File is missing"
Exit Sub
End If

If Dir(bTemp & "nul") = "" Then
MsgBox "To Folder is missing"
Exit Sub
End If

FileCopy aTemp & cTemp, bTemp & cTemp

End Sub

(I changed the D: to C: for my testing. And it seemed to catch any invalid
configuration.)


Jodie wrote:

No, it's not Hidden, I am using NT.

-----Original Message-----
It's not case sensitive for me. (win98 now, and I've

never worried about case
sensitivity in winNT, either.)

Any chance that your datafile.dat is hidden? If you go

to windows explorer and
go to that folder and rightclick on the file, select

properties, do you see a
check mark in the Hidden property?

Jodie wrote:

Hi,

I am trying to write vba macro using Filecopy but I

always
get an error (file not found) while reading the file in
the folder. Is FILECOPY are Upper or Lower case
sensitive? If yes, What is the command that uses or
interprete wether it is a lower or upper case?

here's my code:
Dim a as string
Dim b as string
atemp = "c:\temp\myfile\"
btemp = "d:\temp\yourfile\"
ctemp = "Datafile.dat"

FILECOPY atemp & ctemp, btemp & ctemp

Appreciate your help.

Thanks in advance.
Jodie


--

Dave Peterson

.


--

Dave Peterson

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
Filecopy in vba macro Jodie[_2_] Excel Programming 0 September 5th 03 03:17 PM
Filecopy in vba macro Julio[_2_] Excel Programming 1 September 2nd 03 06:43 PM
FileCopy Dana DeLouis[_5_] Excel Programming 0 August 11th 03 12:57 PM
FileCopy John Green[_2_] Excel Programming 1 August 5th 03 08:55 AM
FileCopy error Chip Pearson Excel Programming 0 August 1st 03 02:43 PM


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

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

About Us

"It's about Microsoft Excel"