Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Filename Recognition

Hi to All:
I have the below code that I am using to modify csv files from having "". I
am having two problems. The filenames for these files need to be consistant,
however the two statements I have marked with <Problem are not recognizing
the files. I am also trying to geth this to only run on Range A1. Can anyone
help?



Sub test2()
Const strFileIn As String = "I:\04 Production Files\IPEP Records\Cleaning
files\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Const strFileOut As String = "I:\04 Production Files\IPEP Records\Cleaned\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long


Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)<Problem

lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1<Problem

Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, -1, vbTextCompare)
fDest.WriteLine strData
Loop

Close
fDest.Close

End Sub

I liked the way you had everything directed in paths in the first set of
coding, but I am having a hard time get the areas above to recognize the
filenames. I have marked the ares with the word "<Problems". Do you have any
suggestions?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Filename Recognition

Help?,

It appears that you are storing a path/folder in both of the Input file & Output file constants and then you are trying to open the
path/folder as a file to read from/write to.

You need to modify your code so that you are opening a specific file, and not a folder/path that your file are in.

I hope this helps,

Conan


"Help?" wrote in message ...
Hi to All:
I have the below code that I am using to modify csv files from having "". I
am having two problems. The filenames for these files need to be consistant,
however the two statements I have marked with <Problem are not recognizing
the files. I am also trying to geth this to only run on Range A1. Can anyone
help?



Sub test2()
Const strFileIn As String = "I:\04 Production Files\IPEP Records\Cleaning
files\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Const strFileOut As String = "I:\04 Production Files\IPEP Records\Cleaned\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long


Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)<Problem

lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1<Problem

Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, -1, vbTextCompare)
fDest.WriteLine strData
Loop

Close
fDest.Close

End Sub

I liked the way you had everything directed in paths in the first set of
coding, but I am having a hard time get the areas above to recognize the
filenames. I have marked the ares with the word "<Problems". Do you have any
suggestions?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Filename Recognition

I have to have it read in this manner. More than one customer will utilize
this piece several times a day and the filename will always be different. If
it was just me using this piece, it would be great. Do you have any ideas of
how I can read variable filenames, maintain them, and consist the programming
below to Range A1?

"Conan Kelly" wrote:

Help?,

It appears that you are storing a path/folder in both of the Input file & Output file constants and then you are trying to open the
path/folder as a file to read from/write to.

You need to modify your code so that you are opening a specific file, and not a folder/path that your file are in.

I hope this helps,

Conan


"Help?" wrote in message ...
Hi to All:
I have the below code that I am using to modify csv files from having "". I
am having two problems. The filenames for these files need to be consistant,
however the two statements I have marked with <Problem are not recognizing
the files. I am also trying to geth this to only run on Range A1. Can anyone
help?



Sub test2()
Const strFileIn As String = "I:\04 Production Files\IPEP Records\Cleaning
files\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Const strFileOut As String = "I:\04 Production Files\IPEP Records\Cleaned\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long


Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)<Problem

lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1<Problem

Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, -1, vbTextCompare)
fDest.WriteLine strData
Loop

Close
fDest.Close

End Sub

I liked the way you had everything directed in paths in the first set of
coding, but I am having a hard time get the areas above to recognize the
filenames. I have marked the ares with the word "<Problems". Do you have any
suggestions?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Filename Recognition

Thank you to all who helped. It was deeply appreciated. If anyone wants to
know how to accomplish this again. Here is the programming that finally
worked.
Sub test2()
Dim strFileIn As String
Dim strFileOut As String
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long

strFileIn = "I:\04 Production Files\IPEP Records\Cleaning files\" +
ActiveWorkbook.Name
strFileOut = "I:\04 Production Files\IPEP Proofs\IPEP Standard Proofs\" +
ActiveWorkbook.Name
Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)

lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1

Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, 2, vbTextCompare)
fDest.WriteLine strData

Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
fDest.WriteLine strData
Loop

Close
fDest.Close



End Sub

"Help?" wrote:

I have to have it read in this manner. More than one customer will utilize
this piece several times a day and the filename will always be different. If
it was just me using this piece, it would be great. Do you have any ideas of
how I can read variable filenames, maintain them, and consist the programming
below to Range A1?

"Conan Kelly" wrote:

Help?,

It appears that you are storing a path/folder in both of the Input file & Output file constants and then you are trying to open the
path/folder as a file to read from/write to.

You need to modify your code so that you are opening a specific file, and not a folder/path that your file are in.

I hope this helps,

Conan


"Help?" wrote in message ...
Hi to All:
I have the below code that I am using to modify csv files from having "". I
am having two problems. The filenames for these files need to be consistant,
however the two statements I have marked with <Problem are not recognizing
the files. I am also trying to geth this to only run on Range A1. Can anyone
help?



Sub test2()
Const strFileIn As String = "I:\04 Production Files\IPEP Records\Cleaning
files\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Const strFileOut As String = "I:\04 Production Files\IPEP Records\Cleaned\"
ActiveWorkbook.SaveAs filename:=ActiveWorkbook.FullName
Dim FSO As Scripting.FileSystemObject
Dim fDest As Scripting.TextStream
Dim strData As String
Dim lngFNum1 As Long


Set FSO = New Scripting.FileSystemObject
Set fDest = FSO.CreateTextFile(strFileOut, True)<Problem

lngFNum1 = FreeFile()
Open strFileIn For Input As #lngFNum1<Problem

Do While Not EOF(lngFNum1)
Line Input #lngFNum1, strData
strData = Replace(strData, """", "", 1, -1, vbTextCompare)
fDest.WriteLine strData
Loop

Close
fDest.Close

End Sub

I liked the way you had everything directed in paths in the first set of
coding, but I am having a hard time get the areas above to recognize the
filenames. I have marked the ares with the word "<Problems". Do you have any
suggestions?





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
quadrant recognition Aleksandr Excel Discussion (Misc queries) 1 September 20th 07 02:24 PM
Converting a Variable Filename to a Constant Filename Magnivy Excel Programming 2 August 15th 06 06:13 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
set excel <filename to <filename-date bob engler Excel Programming 2 July 12th 06 08:22 AM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM


All times are GMT +1. The time now is 07:53 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"