Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WILD CARD IN FILECOPY 1

Status
Not open for further replies.

vbesoft

Programmer
Joined
Aug 15, 2002
Messages
6
Location
US
I am new to Visual Basic and it seams what should be simple eludes me! So please bear with me.

What I tried to accomplish is

Private Sub PlotVersaCad_Click()
FileCopy "e:\spool\es.spl", "\\f\fhp\es.SPL"
End Sub

but instead of copying one file i.e. es.spl I need to say *.spl and FileCopy will not let you do this. How do you work around this in Visual Basic
 
you could try the FileSystemObject

Code:
Dim oFSO As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile "C:\*.txt", "I:\", True
Set oFSO = Nothing
 
I gave oFSO.CopyFile a try and got the error code
Path not found
this is how it is written

Private Sub PlotVersaCad_Click()
Dim oFSO As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile "e:\spool\*.spl", "\\f\fhp\", True
Set oFSO = Nothing
End Sub

\\f\fhp is a printer on the network.
 
you did not say you were copying it to a printer

try

Code:
Dim sFile As String
Dim sFolder As String

sFolder = "e:\spool\"
sFile = Dir(sFolder & "*.spl")

Do While sFile <> &quot;&quot;
  FileCopy sFolder & sFile, &quot;\\f\fhp&quot;
  sFile = Dir
Loop
 
when I FileCopy sFolder & sFile, &quot;\\f\fhp&quot; I get the error Ivalid Procedure call or Argument on the &quot;\\f\fhp&quot; any Idea how to resolve.
 
I tested the code here using &quot;\\Pc4467\hp&quot; where &quot;Pc4467&quot; is a PC on our network.
is &quot;\\f\fhp&quot; a valid network share?
 
I double checked that it is shown on the network and that share is checked. it is also mapped to lpt3 on the other computers so that dos can also access it.
 
I figured out the problem today. the problem is that you cannot capture the printer to a port for dos for some reason when you do you get the error I encountered. when you uncapture the port the problem goes away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top