Delimiter değiştirme

Katılım
29 Mart 2007
Mesajlar
14
Excel Vers. ve Dili
2003Eng
Kod:
Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" ( _
                                    ByVal Locale As Long, _
                                    ByVal LCType As Long, _
                                    ByVal lpLCData As String) As Boolean
Private Declare Function GetUserDefaultLCID% Lib "kernel32" ()

Sub Veri_Al()
Dim cn As Object
Dim rs As Object
Dim myPath As String
Dim i As Long
Dim j As Integer

'**************************************************************************************************
'Bölgesel ayarların değişimi
SetLocaleInfo GetUserDefaultLCID(), &HE, "." 'Ondalık yeni sembol
SetLocaleInfo GetUserDefaultLCID(), &HF, "," 'Binlik yeni sembol
'**************************************************************************************************

Set cn = CreateObject("ADODB.Connection")
myPath = "c:\deneme" 'TXT dosyasının bulunduğu dizin.
cn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & myPath & _
";Extended Properties=""text;HDR=No;FMT=delimited"""
Set rs = cn.Execute( _
"SELECT * FROM [deneme.txt]")
i = 3
While Not rs.EOF
    If Minute(rs(0)) Mod 60 = 0 Then
        i = i + 1
        For j = 0 To rs.Fields.Count - 1
        Cells(i, j + 1) = rs(j)
        Next
        Cells(i, 1) = CDate(Cells(i, 1))
    End If
rs.movenext
Wend
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing

'**************************************************************************************************
'Bölgesel ayarların eski ayarlara dönüşü
SetLocaleInfo GetUserDefaultLCID(), &HE, ","
SetLocaleInfo GetUserDefaultLCID(), &HF, "."
'**************************************************************************************************

End Sub
arkadaşlar yukarıdaki kod ile yeri belirtilmiş olan bir text dosyasında sorunsuz vede oldukça hızlı bir şekilde veri alımı sağlanabilmekte.
sorum ise şu olacak text dosyasında ayraç olrak ; , tab karakteri yada özel bir karakter varsa bu delimiter olarak belirtilebileceğine dair bilgiler evcut
ancak ayrıcı olarak space karakteri kullanılmış ise bu nasıl belirtilmesi gereklidir?
bu konuda herhangibir bilgi göremedim.

ilginiz için teşekkürler!
 
Üst