Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Open CSV File

Hello
I have been using the following code to open files Until now the files were
supplied as .xls files. However now they are being supplied as .csv Files.

Dim MyPath As String
Dim FilesInPath As String
Dim MyFiles() As String
Dim SourceRcount As Long
Dim Fnum As Long
Dim mybook As Workbook
Dim basebook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim sfolder As String

sfolder = ThisWorkbook.Path

MyPath = sfolder
MsgBox (MyPath)

If Right(MyPath, 1) < "\" Then
MyPath = MyPath & "\"
End If

FilesInPath = Dir(MyPath & "*.xls")
MsgBox (FilesInPath)
If FilesInPath = "" Then
MsgBox "No files found"

Exit Sub
End If
How do I modify to open the .csv files. Changing FilesInPath = Dir(MyPath
& "*.xls")
to
FilesInPath = Dir(MyPath & "*.csv"), doesn't work.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Open CSV File

Test it again, this must work correct


"Thanks" schreef in bericht
...
Hello
I have been using the following code to open files Until now the files
were
supplied as .xls files. However now they are being supplied as .csv
Files.

Dim MyPath As String
Dim FilesInPath As String
Dim MyFiles() As String
Dim SourceRcount As Long
Dim Fnum As Long
Dim mybook As Workbook
Dim basebook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim sfolder As String

sfolder = ThisWorkbook.Path

MyPath = sfolder
MsgBox (MyPath)

If Right(MyPath, 1) < "\" Then
MyPath = MyPath & "\"
End If

FilesInPath = Dir(MyPath & "*.xls")
MsgBox (FilesInPath)
If FilesInPath = "" Then
MsgBox "No files found"

Exit Sub
End If
How do I modify to open the .csv files. Changing FilesInPath = Dir(MyPath
& "*.xls")
to
FilesInPath = Dir(MyPath & "*.csv"), doesn't work.


__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Open CSV File

I ve tried several times. With xls files in the folder it works, but when I
change to the code to .csv it doesnt work.

"Ron de Bruin" wrote:

Test it again, this must work correct


"Thanks" schreef in bericht
...
Hello
I have been using the following code to open files Until now the files
were
supplied as .xls files. However now they are being supplied as .csv
Files.

Dim MyPath As String
Dim FilesInPath As String
Dim MyFiles() As String
Dim SourceRcount As Long
Dim Fnum As Long
Dim mybook As Workbook
Dim basebook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim sfolder As String

sfolder = ThisWorkbook.Path

MyPath = sfolder
MsgBox (MyPath)

If Right(MyPath, 1) < "\" Then
MyPath = MyPath & "\"
End If

FilesInPath = Dir(MyPath & "*.xls")
MsgBox (FilesInPath)
If FilesInPath = "" Then
MsgBox "No files found"

Exit Sub
End If
How do I modify to open the .csv files. Changing FilesInPath = Dir(MyPath
& "*.xls")
to
FilesInPath = Dir(MyPath & "*.csv"), doesn't work.


__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Open CSV File

Send me one or two of the csv files private and I take a look

You can find my mail address here
http://www.rondebruin.nl/



"Thanks" schreef in bericht
...
I ve tried several times. With xls files in the folder it works, but when
I
change to the code to .csv it doesnt work.

"Ron de Bruin" wrote:

Test it again, this must work correct


"Thanks" schreef in bericht
...
Hello
I have been using the following code to open files Until now the files
were
supplied as .xls files. However now they are being supplied as .csv
Files.

Dim MyPath As String
Dim FilesInPath As String
Dim MyFiles() As String
Dim SourceRcount As Long
Dim Fnum As Long
Dim mybook As Workbook
Dim basebook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim sfolder As String

sfolder = ThisWorkbook.Path

MyPath = sfolder
MsgBox (MyPath)

If Right(MyPath, 1) < "\" Then
MyPath = MyPath & "\"
End If

FilesInPath = Dir(MyPath & "*.xls")
MsgBox (FilesInPath)
If FilesInPath = "" Then
MsgBox "No files found"

Exit Sub
End If
How do I modify to open the .csv files. Changing FilesInPath =
Dir(MyPath
& "*.xls")
to
FilesInPath = Dir(MyPath & "*.csv"), doesn't work.


__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Open CSV File

Problem fixed : The csv files where in another folder, so that was the
reason that the code say No files found

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ron de Bruin" schreef in bericht
...
Send me one or two of the csv files private and I take a look

You can find my mail address here
http://www.rondebruin.nl/



"Thanks" schreef in bericht
...
I ve tried several times. With xls files in the folder it works, but when
I
change to the code to .csv it doesnt work.

"Ron de Bruin" wrote:

Test it again, this must work correct


"Thanks" schreef in bericht
...
Hello
I have been using the following code to open files Until now the
files
were
supplied as .xls files. However now they are being supplied as .csv
Files.

Dim MyPath As String
Dim FilesInPath As String
Dim MyFiles() As String
Dim SourceRcount As Long
Dim Fnum As Long
Dim mybook As Workbook
Dim basebook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim sfolder As String

sfolder = ThisWorkbook.Path

MyPath = sfolder
MsgBox (MyPath)

If Right(MyPath, 1) < "\" Then
MyPath = MyPath & "\"
End If

FilesInPath = Dir(MyPath & "*.xls")
MsgBox (FilesInPath)
If FilesInPath = "" Then
MsgBox "No files found"

Exit Sub
End If
How do I modify to open the .csv files. Changing FilesInPath =
Dir(MyPath
& "*.xls")
to
FilesInPath = Dir(MyPath & "*.csv"), doesn't work.


__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus
signature database 4285 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus
signature database 4286 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com





__________ Information from ESET Smart Security, version of virus signature database 4286 (20090728) __________

The message was checked by ESET Smart Security.

http://www.eset.com



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
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
Open a file do a macro ( made) and open next succesive file SVTman74 Excel Programming 5 April 21st 06 10:14 PM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 2 July 8th 05 05:51 AM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 0 July 2nd 05 08:41 PM


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