Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Where am I going wrong with this?

Having read through the messages on the NG, I thought that the sub
below did something very similar to what i needed, and so added it to
my procedure.

What I have is a proc that imports all the xls files in a specified
folder before renaming the file as a CSV file in preparation for
import to a DOS database. Everything works great on it, so I thought I
would get the proc to move the files from the holding folder to the
imported folder.

As the import procedure loops through each of the XLS files in the
folder, I wanted to call the demo proc, and move the files as it goes.

I ran it and had a look at the k:\bgas folder - nothing in there so it
must have worked. Except it hasn't. The files haven't appeared in the
ToFolder.

I put a MsgBox in the proc to see what it was passing and it all looks
ok to me, as the correct file name is passed each time, but obviously
I have done something wrong. Any suggestions welcome.

regards

Andrew H


Sub Demo(FNames)
Dim FromFolder As String
Dim ToFolder As String

FromFolder = "K:\BGAS\" & FNames
ToFolder = "K:\BGAS\IMPORTED"

On Error Resume Next
With CreateObject("Scripting.FileSystemObject")
.CopyFile FromFolder, ToFolder, True
.DeleteFile FromFolder, True
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Where am I going wrong with this?

Add a backslash after "IMPORTED" and see how that works.
Jim
-----Original Message-----
Having read through the messages on the NG, I thought

that the sub
below did something very similar to what i needed, and so

added it to
my procedure.

What I have is a proc that imports all the xls files in a

specified
folder before renaming the file as a CSV file in

preparation for
import to a DOS database. Everything works great on it,

so I thought I
would get the proc to move the files from the holding

folder to the
imported folder.

As the import procedure loops through each of the XLS

files in the
folder, I wanted to call the demo proc, and move the

files as it goes.

I ran it and had a look at the k:\bgas folder - nothing

in there so it
must have worked. Except it hasn't. The files haven't

appeared in the
ToFolder.

I put a MsgBox in the proc to see what it was passing and

it all looks
ok to me, as the correct file name is passed each time,

but obviously
I have done something wrong. Any suggestions welcome.

regards

Andrew H


Sub Demo(FNames)
Dim FromFolder As String
Dim ToFolder As String

FromFolder = "K:\BGAS\" & FNames
ToFolder = "K:\BGAS\IMPORTED"

On Error Resume Next
With CreateObject("Scripting.FileSystemObject")
.CopyFile FromFolder, ToFolder, True
.DeleteFile FromFolder, True
End With
End Sub
.

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
help please what am i doing wrong? Nevyn Excel Discussion (Misc queries) 1 February 9th 10 10:50 PM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
What Am I Doing Wrong comparini3000 Excel Discussion (Misc queries) 1 June 12th 06 05:51 PM
What am I doing wrong? jewels Excel Worksheet Functions 8 December 8th 05 02:04 PM
Where am I going wrong? Pank Excel Discussion (Misc queries) 2 July 13th 05 01:05 PM


All times are GMT +1. The time now is 05:37 PM.

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"