Solved

FileCopy Command VB4

Posted on 1999-01-02
5
286 Views
Last Modified: 2012-05-04
I have an App which uses the FileCopy command to copy files with wildcards....i.e.    *.dll       Apparently FileCopy does not support this.  If this is so, does anyone have a workaround?
0
Comment
Question by:et1dkn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 200 total points
ID: 1453626
Private Sub Command1_Click()
Dim i
For i = 0 To File1.ListCount - 1
If File1.List(i) Like "*.myext" Then
FileCopy File1.List(i), "mycopy of" & File1.List(i)
End If
Next

End Sub
0
 
LVL 1

Expert Comment

by:RichardE
ID: 1453627
For some reason my Answer of earlier today does not show up - so I will submit again. jbil's answer assumes you are using a file list. I do not assume that ... so here it is again:

Sub CopyFiles()
    '-- This example copies all *.txt files in current path to a: root
    Dim sFileName     As String
    Dim sCurrentPath  As String
               
    '-- Test path for being a ROOT
    If Right(App.Path, 1) <> "\" Then
        sCurrentPath = App.Path & "\"
    Else
        sCurrentPath = App.Path
    End If
   
    '-- See if at least one file exists
    sFileName = Dir(sCurrentPath & "*.txt")
    If sFileName = "" Then
        MsgBox "No .txt files to copy"
    Else
        '-- Copy any other files that match our criteria to the ROOT of A:
        Do
            FileCopy sCurrentPath & sFileName, "A:\" & sFileName
            sFileName = Dir
            If sFileName = "" Then
                Exit Do
            End If
        Loop
    End If
             
End Sub



0
 

Author Comment

by:et1dkn
ID: 1453628
from et1dkn:
I posted a question on 1/2/1999..an answer was proposed by jbil and was adequate for my problem.  RichardE also proposed an answer that provided me some other useful info..but the Experts Exchange system went down blocking his answer until 1/3/1999. I would like to credit him with points also.
How do I do that?

et1dkn@aol.com

0
 
LVL 1

Expert Comment

by:RichardE
ID: 1453629
et1dkn:

I appreciate that but don't waste your time. I'll live without the 20 points. I just hope I have helped you over your little stumbling block...

I too noticed the meltdown and that's why it's a week later, besides the fact that I have to do the 40+ hours for "the man" and project delivery is near.
0
 

Author Comment

by:et1dkn
ID: 1453630
RichardE:
Thanks anyway. The object I was trying to reach was not as simple as the question appeared in the context of what I was trying to do......but both answers did steer me in the right direction.  Thanks again (by the way,the points were 200, but I guess the malfunction shuffled that around too)

et1dkn

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question